[JBossWS] - How to use Username Token
by Dark Fett
Hello,
I'm trying to use Username Token but it's not successful for now. The Username Token is not present in the Header of my request. (Signature and Encryption work fine in both side)
Here's my code :
jboss-wsse-client.xml
<?xml version="1.0" encoding="UTF-8"?>
| <jboss-ws-security xmlns="http://www.jboss.com/ws-security/config"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://www.jboss.com/ws-security/config
| http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd">
|
| <key-store-file>service.jks</key-store-file>
| <key-store-password>apache</key-store-password>
|
| <trust-store-file>client.jks</trust-store-file>
| <trust-store-password>apache</trust-store-password>
| <config>
| <username/>
| <sign type="x509v3" alias="service"/>
| <requires>
| <signature/>
| </requires>
| </config>
| </jboss-ws-security>
That's part seems to be good. But I don't know how to insert my own username and my password in MyCall.java.
MyCall.java
| Service service = Service.create(
| new URL("http://proxiadev34:8080/SampleJBossWS/PersonneWebService?wsdl"),
| new QName("PersonneWebServiceService")
| );
|
| URL securityURL = new File("jboss-wsse-client.xml").toURL();
| ((ServiceExt)service).setSecurityConfig(securityURL.toExternalForm());
|
|
| PersonneWebService personneWS = service.getPort(PersonneWebService.class);
| ((StubExt)personneWS).setConfigName("Standard WSSecurity Client");
|
| //Appel de la Fonction getNomVille(Long codePostal)
| String ville = personneWS.getNomVille(59000);
| System.out.println(ville);
For the server, I found the way to get the Username Token from the Request
String username = SecurityAssociation.getPrincipal().getName();
| String password = SecurityAssociation.getCredential().toString();
|
| System.out.println(username);
| System.out.println(password);
If anybody have an idea in order to put the username and the password, it would be welcome.
Thank you for nay help.
Dark Fett
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4040908#4040908
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4040908
17 years, 9 months