}
}
public Message invoke(Message msg) {
Axis2SOAPHeaderString header = (Axis2SOAPHeaderString)Axis2HeaderPolicyUtil.getHeader(msg, policy.getTokenName());
if (header != null) {
System.out.println("Web service received token: " + header.getHeaderString());
// call out here to some 3rd party system to do whatever you
// need to turn header credentials into an authenticated principal
Subject subject = SecurityUtil.getSubject(msg);
Principal principal = new TokenPrincipal(header.getHeaderString());
subject.getPrincipals().add(principal);
}
return getNext().invoke(msg);
}