use of org.forgerock.openam.sts.rest.token.validator.RestIssuedTokenValidator in project OpenAM by OpenRock.
the class IssuedTokenValidateOperationImpl method validateToken.
public JsonValue validateToken(RestSTSTokenValidationInvocationState invocationState) throws TokenValidationException, TokenMarshalException {
TokenTypeId tokenTypeId = tokenRequestMarshaller.getTokenType(invocationState.getValidatedTokenState());
RestIssuedTokenValidatorParameters<?> validatorParameters = tokenRequestMarshaller.buildIssuedTokenValidatorParameters(invocationState.getValidatedTokenState());
for (RestIssuedTokenValidator tokenValidator : tokenValidators) {
if (tokenValidator.canValidateToken(tokenTypeId)) {
@SuppressWarnings("unchecked") boolean tokenValid = tokenValidator.validateToken(validatorParameters);
return json(object(field(AMSTSConstants.TOKEN_VALID, tokenValid)));
}
}
throw new TokenValidationException(ResourceException.BAD_REQUEST, "No IssuedTokenValidators available for " + "token type: " + tokenTypeId.getId() + ". Does this sts issue tokens of the specified type?");
}
Aggregations