Author: bfitzpat
Date: 2010-08-10 10:09:52 -0400 (Tue, 10 Aug 2010)
New Revision: 24019
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXWSTester2.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView2.java
Log:
OPEN - issue JBIDE-6660: [tester] does not handle password protected services
https://jira.jboss.org/browse/JBIDE-6660
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties 2010-08-10
13:54:22 UTC (rev 24018)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties 2010-08-10
14:09:52 UTC (rev 24019)
@@ -108,6 +108,7 @@
JAXRSWSTestView_Set_Sample_Data_Label=Set Sample Data
JAXRSWSTestView_Web_Service_Type_Label=Web Service Type:
JAXRSWSTestView2_BodyText_Section=Body Text
+JAXRSWSTestView2_Checkbox_Basic_Authentication=Prompt for Basic Authentication
JAXRSWSTestView2_GetFromWSDL_Tooltip=Get from WSDL
JAXRSWSTestView2_Go_Tooltip=Invoke
JAXRSWSTestView2_Headers_Section=Headers
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java 2010-08-10
13:54:22 UTC (rev 24018)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java 2010-08-10
14:09:52 UTC (rev 24019)
@@ -139,6 +139,7 @@
public static String JAXRSWSTestView_Set_Sample_Data_Label;
public static String JAXRSWSTestView_Web_Service_Type_Label;
public static String JAXRSWSTestView2_BodyText_Section;
+ public static String JAXRSWSTestView2_Checkbox_Basic_Authentication;
public static String JAXRSWSTestView2_GetFromWSDL_Tooltip;
public static String JAXRSWSTestView2_Go_Tooltip;
public static String JAXRSWSTestView2_Headers_Section;
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXWSTester2.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXWSTester2.java 2010-08-10
13:54:22 UTC (rev 24018)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JAXWSTester2.java 2010-08-10
14:09:52 UTC (rev 24019)
@@ -111,14 +111,23 @@
}
if (uid != null && pwd != null) {
- Map<String, Object> requestContext = d.getRequestContext();
- requestContext.put(BindingProvider.USERNAME_PROPERTY, uid);
- requestContext.put(BindingProvider.PASSWORD_PROPERTY, pwd);
+ d.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, uid);
+ d.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, pwd);
}
SOAPMessage m = mf.createMessage( null, new ByteArrayInputStream(body.getBytes()));
m.saveChanges();
+ // this is a different method of passing along security details
+// if (uid != null && pwd != null) {
+// String authStr = uid + ':' + pwd;
+// byte[] authEncByte = Base64.encodeBase64(authStr.getBytes());
+// String authStringEnc = new String(authEncByte);
+//
+// MimeHeaders hd = m.getMimeHeaders();
+// hd.addHeader("Authorization", "Basic " + authStringEnc);
//$NON-NLS-1$//$NON-NLS-2$
+// }
+
Response<SOAPMessage> response = d.invokeAsync(m);
while (!response.isDone()){
//go off and do some work
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView2.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView2.java 2010-08-10
13:54:22 UTC (rev 24018)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView2.java 2010-08-10
14:09:52 UTC (rev 24019)
@@ -75,6 +75,7 @@
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.CoolBar;
@@ -182,6 +183,7 @@
private TestHistory history = new TestHistory();
private TestHistoryEntry currentHistoryEntry = null;
+ private Button useBasicAuthCB;
/**
* The constructor.
@@ -702,6 +704,11 @@
gd9.minimumHeight = 200;
ec5.setLayoutData(gd9);
ec5.addExpansionListener(new FormExpansionAdapter());
+
+ useBasicAuthCB = toolkit.createButton(sectionClient,
+ JBossWSUIMessages.JAXRSWSTestView2_Checkbox_Basic_Authentication, SWT.CHECK);
+ GridData gd10 = new GridData(SWT.FILL, SWT.NONE, true, false);
+ useBasicAuthCB.setLayoutData(gd10);
section.addExpansionListener(new FormExpansionAdapter());
section.setClient(sectionClient);
@@ -1163,8 +1170,8 @@
String tempUID = null;
String tempPwd = null;
- // temp workaround to handle JAX-RS authenticated services
- if (wsTech.contentEquals(JAX_RS) && url.startsWith("https")) {
//$NON-NLS-1$
+ // If basic authorization checkbox is checked, use the uid/pwd
+ if (useBasicAuthCB.getSelection()) {
UidPwdDialog authDialog = new UidPwdDialog(getSite().getShell());
int rtnCode = authDialog.open();
if (rtnCode == Window.OK) {