You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by John Doe <pa...@earthlink.net> on 2007/11/02 15:05:17 UTC
Accessing security header from service
Hi,
I successfully deployed Axis2+Rampart together and I'm using simple
username/password authentication.
Service is simple, it takes few parameters and it needs to store them in
database along with username of user that made the request.
I have username/password information in PwdCallbackHandler that Rampart
calls, but I don't know how to pass that information to service.
Is there a way to access security header from service or somehow append
username/password info to the body of the request when it passes through
Rampart?
Thanks!
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: Accessing security header from service
Posted by Massimiliano Masi <ma...@math.unifi.it>.
Ciao,
Quoting Todd Allen <tb...@copart.com>:
> This link may help:
> http://wso2.org/library/169
This might be outdated. Try this code:
Vector results = null;
String username = null;
if ((results = (Vector) inMsgCtx
.getProperty(WSHandlerConstants.RECV_RESULTS)) == null)
throw new RuntimeException("No security results!!");
else {
for (int i = 0; i < results.size(); i++) {
// Get hold of the WSHandlerResult instance
WSHandlerResult rResult = (WSHandlerResult) results.get(i);
Vector wsSecEngineResults = rResult.getResults();
for (int j = 0; j < wsSecEngineResults.size(); j++) {
// Get hold of the WSSecurityEngineResult instance
WSSecurityEngineResult wser = (WSSecurityEngineResult)
wsSecEngineResults.get(j);
// Extract the principal
Collection values = wser.values();
Iterator valuesIt = values.iterator();
while (valuesIt.hasNext()) {
Object o = valuesIt.next();
if (o instanceof WSUsernameTokenPrincipal) {
WSUsernameTokenPrincipal principal = (WSUsernameTokenPrincipal) o;
username = principal.getName();
}
// Todo: to see if it is instance of kerberos token
// etc.
}
}
}
}
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: Accessing security header from service
Posted by Todd Allen <tb...@copart.com>.
This link may help:
http://wso2.org/library/169
At 10:05 AM 11/2/2007, John Doe wrote:
>Hi,
>
>I successfully deployed Axis2+Rampart together and I'm using simple
>username/password authentication.
>Service is simple, it takes few parameters and it needs to store
>them in database along with username of user that made the request.
>I have username/password information in PwdCallbackHandler that
>Rampart calls, but I don't know how to pass that information to service.
>Is there a way to access security header from service or somehow
>append username/password info to the body of the request when it
>passes through Rampart?
>
>Thanks!
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>For additional commands, e-mail: axis-user-help@ws.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org