javax.jms.Message jmsMsg = msg.getBody();
if ( policy.getTokenName() != null){
Subject subject = SecurityUtil.getSubject(msg);
TokenPrincipal principal = SecurityUtil.getPrincipal(subject, TokenPrincipal.class);
if (principal == null){
// should call out here to some 3rd party system to get credentials
// and correct token. Here we are just putting in the token name
principal = new TokenPrincipal("DummyTokenID");
subject.getPrincipals().add(principal);
}
jmsMsg.setStringProperty(policy.getTokenName().toString(), principal.getName());
}
return getNext().invoke(msg);
} catch (JMSException e) {