if (authnCtx != null){
context.getOtherProperties().put(IssuedTokenContext.AUTHN_CONTEXT, authnCtx);
}
// Get Claims from the RST
Claims claims = rst.getClaims();
if (claims == null && secParas != null){
claims = secParas.getClaims();
}
if (claims != null){
// Add supporting information
List<Object> si = rst.getExtensionElements();
claims.getSupportingProperties().addAll(si);
if (at != null){
claims.getSupportingProperties().addAll(at);
}
}else{
claims = eleFac.createClaims();
}
String confirMethod = null;
Element assertionInRST = (Element)stsConfig.getOtherOptions().get(WSTrustConstants.SAML_ASSERTION_ELEMENT_IN_RST);
// Handle OnBehalfOf token
OnBehalfOf obo = rst.getOnBehalfOf();
if (obo != null){
Object oboToken = obo.getAny();
if (assertionInRST != null){
oboToken = assertionInRST;
}
if (oboToken != null){
subject.getPublicCredentials().add(eleFac.toElement(oboToken));
// set OnBehalfOf attribute
claims.getOtherAttributes().put(new QName("OnBehalfOf"), "true");
context.getOtherProperties().put("OnBehalfOf", "true");
// Create a Subject with ActAs credential and put it in claims
Subject oboSubj = new Subject();
oboSubj.getPublicCredentials().add(eleFac.toElement(oboToken));
claims.getSupportingProperties().add(oboSubj);
}
}
// Handle ActAs token
ActAs actAs = rst.getActAs();
if (actAs != null){
Object actAsToken = actAs.getAny();
if (assertionInRST != null){
actAsToken = assertionInRST;
}
if (actAsToken != null){
// set ActAs attribute
claims.getOtherAttributes().put(new QName("ActAs"), "true");
context.getOtherProperties().put("ActAs", "true");
// Create a Subject with ActAs credential and put it in claims
Subject actAsSubj = new Subject();
actAsSubj.getPublicCredentials().add(eleFac.toElement(actAsToken));
claims.getSupportingProperties().add(actAsSubj);
}
}
if (confirMethod != null){
context.getOtherProperties().put(IssuedTokenContext.CONFIRMATION_METHOD, confirMethod);