RequestedSecurityTokenType requestedSecurityToken = new RequestedSecurityTokenType();
requestedSecurityToken.setAny(requestContext.getSecurityToken().getTokenValue());
// TODO: create proof token and encrypt the token if needed
RequestSecurityTokenResponse response = new RequestSecurityTokenResponse();
if (request.getContext() != null)
response.setContext(request.getContext());
response.setTokenType(request.getTokenType());
response.setLifetime(request.getLifetime());
response.setAppliesTo(appliesTo);
response.setRequestedSecurityToken(requestedSecurityToken);
// set the attached and unattached references.
if (requestContext.getAttachedReference() != null)
response.setRequestedAttachedReference(requestContext.getAttachedReference());
if (requestContext.getUnattachedReference() != null)
response.setRequestedUnattachedReference(requestContext.getUnattachedReference());
return response;
}
else
throw new WSTrustException("Unable to find a token provider for the token request");