IssuedTokenKeyBinding itkb = new IssuedTokenKeyBinding();
setTokenInclusion(itkb,(Token) tokenAssertion);
//itkb.setPolicyToken((Token) tokenAssertion);
itkb.setUUID(((Token)tokenAssertion).getTokenId());
itkb.setSTRID(token.getTokenId());
IssuedToken it = (IssuedToken)tokenAssertion;
itkb.isOptional(tokenAssertion.isOptional());
if (it.getRequestSecurityTokenTemplate() != null) {
itkb.setTokenType(it.getRequestSecurityTokenTemplate().getTokenType());
}
if(it.getIssuer() != null){
Address addr = it.getIssuer().getAddress();
if(addr != null)
itkb.setIssuer(addr.getURI().toString());
} else if(it.getIssuerName() != null){
itkb.setIssuer(it.getIssuerName().getIssuerName());
}
if(it.getClaims() != null){
itkb.setClaims(it.getClaims().getClaimsAsBytes());
}
if(it.isRequireDerivedKeys()){
DerivedTokenKeyBinding dtKB = new DerivedTokenKeyBinding();
dtKB.setOriginalKeyBinding(itkb);
policy.setKeyBinding(dtKB);
dtKB.setUUID(pid.generateID());
}else{