Collection<AssertionInfo> ais = aim.get(SP12Constants.ISSUED_TOKEN);
if (ais == null || ais.isEmpty()) {
return;
}
if (isRequestor(message)) {
IssuedToken itok = (IssuedToken)ais.iterator().next().getAssertion();
SecurityToken tok = (SecurityToken)message.getContextualProperty(SecurityConstants.TOKEN);
if (tok == null) {
String tokId = (String)message.getContextualProperty(SecurityConstants.TOKEN_ID);
if (tokId != null) {
tok = getTokenStore(message).getToken(tokId);
}
}
if (tok == null) {
STSClient client = STSUtils.getClient(message, "sts");
AddressingProperties maps =
(AddressingProperties)message
.get("javax.xml.ws.addressing.context.outbound");
if (maps == null) {
maps = (AddressingProperties)message
.get("javax.xml.ws.addressing.context");
}
synchronized (client) {
try {
// Transpose ActAs/OnBehalfOf info from original request to the STS client.
Object token =
message.getContextualProperty(SecurityConstants.STS_TOKEN_ACT_AS);
if (token != null) {
client.setActAs(token);
}
token =
message.getContextualProperty(SecurityConstants.STS_TOKEN_ON_BEHALF_OF);
if (token != null) {
client.setOnBehalfOf(token);
}
client.setMessage(message);
client.setTrust(getTrust10(aim));
client.setTrust(getTrust13(aim));
client.setTemplate(itok.getRstTemplate());
if (maps == null) {
tok = client.requestSecurityToken();
} else {
Object o = message
.getContextualProperty(SecurityConstants.STS_APPLIES_TO);