Hi everyone,
I'm attempting to write a service that simply tells me who authenicated
from the client side. I've been using the tutorial given at
http://wso2.org/library/169 as a guide. The code snippet below is at the
service side:
Vector results = null;
WSSecurityEngineResult wser=null;
MessageContext msgCtx = new MessageContext();
if ((results = (Vector)
msgCtx.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
wser =
(WSSecurityEngineResult)wsSecEngineResults.get(j);
}
}
}
//Extract the principal
WSUsernameTokenPrincipal principal =
(WSUsernameTokenPrincipal)wser.getPrincipal();
//Get username
String user = principal.getName();
return user;
However, I'm getting an Axisfault as shown below:
Exception in thread "main" org.apache.axis2.AxisFault: No security
results!!
So basically the results of the security processing isn't being
returned. What am I doing wrong? The only thing I can think of is that
I've wrongly created the MessageContext instance. Any ideas on how I
should proceed? Cheers.
Regards
--------------
Sanjay Vivek
Web Analyst
Middleware Team
ISS
University of Newcastle Upon Tyne