use of org.gluu.oxauth.model.common.IntrospectionResponse in project oxTrust by GluuFederation.
the class DefaultTestModeProtectionService method processIntrospectionResponse.
public Response processIntrospectionResponse(IntrospectionResponse iresponse, ResourceInfo resourceInfo) {
Response response = null;
if (iresponse == null || !iresponse.isActive()) {
String msg = "Invalid token";
log.error(msg);
// see section 3.12 RFC 7644
response = IProtectionService.simpleResponse(Response.Status.FORBIDDEN, msg);
}
return response;
}
use of org.gluu.oxauth.model.common.IntrospectionResponse in project oxAuth by GluuFederation.
the class IntrospectionWsHttpTest method bearer.
@Test
@Parameters({ "umaPatClientId", "umaPatClientSecret" })
public void bearer(final String umaPatClientId, final String umaPatClientSecret) throws Exception {
final Token authorization = UmaClient.requestPat(tokenEndpoint, umaPatClientId, umaPatClientSecret);
final Token tokenToIntrospect = UmaClient.requestPat(tokenEndpoint, umaPatClientId, umaPatClientSecret);
final IntrospectionService introspectionService = ClientFactory.instance().createIntrospectionService(introspectionEndpoint);
final IntrospectionResponse introspectionResponse = introspectionService.introspectToken("Bearer " + authorization.getAccessToken(), tokenToIntrospect.getAccessToken());
assertTrue(introspectionResponse != null && introspectionResponse.isActive());
}
use of org.gluu.oxauth.model.common.IntrospectionResponse in project oxAuth by GluuFederation.
the class IntrospectionWsHttpTest method introspectWithValidAuthorizationButInvalidTokenShouldReturnActiveFalse.
@Test
@Parameters({ "umaPatClientId", "umaPatClientSecret" })
public void introspectWithValidAuthorizationButInvalidTokenShouldReturnActiveFalse(final String umaPatClientId, final String umaPatClientSecret) throws Exception {
final Token authorization = UmaClient.requestPat(tokenEndpoint, umaPatClientId, umaPatClientSecret, clientEngine(true));
final IntrospectionService introspectionService = ClientFactory.instance().createIntrospectionService(introspectionEndpoint, clientEngine(true));
final IntrospectionResponse introspectionResponse = introspectionService.introspectToken("Bearer " + authorization.getAccessToken(), "invalid_token");
assertNotNull(introspectionResponse);
assertFalse(introspectionResponse.isActive());
}
Aggregations