use of io.jans.ca.common.params.IntrospectRptParams in project jans by JanssenProject.
the class UmaSpontaneousScopeTest method init.
@Parameters({ "host", "opHost", "paramRedirectUrl", "userId", "userSecret", "rsProtectWithSpontaneousScope" })
@Test
public void init(String host, String opHost, String paramRedirectUrl, String userId, String userSecret, String rsProtectWithSpontaneousScope) throws Exception {
List<String> scopes = Lists.newArrayList("openid", "uma_protection", "profile", "address", "email", "phone", "user_name", "jans_client_api");
List<String> responseTypes = Lists.newArrayList("code", "id_token", "token");
// register client
ClientInterface client = Tester.newClient(host);
final RegisterSiteResponse registerResponse = RegisterSiteTest.registerSite(client, opHost, paramRedirectUrl, scopes, responseTypes, true, null);
// UMA RP - Get RPT
// Spontaneous Scope Regress: ^/user/.+$
RpGetRptResponse response = RpGetRptTest.requestRpt(client, registerResponse, rsProtectWithSpontaneousScope);
// UMA Introspect RPT
IntrospectRptParams params = new IntrospectRptParams();
params.setRpId(registerResponse.getRpId());
params.setRpt(response.getRpt());
final CorrectRptIntrospectionResponse rptIntrospectionResponse = client.introspectRpt(Tester.getAuthorization(registerResponse), null, params);
rptIntrospectionResponse.getPermissions().forEach(permission -> {
assertTrue(permission.getScopes().contains(USER_2_SCOPE));
});
}
use of io.jans.ca.common.params.IntrospectRptParams in project jans by JanssenProject.
the class IntrospectRptTest method test.
@Parameters({ "host", "opHost", "redirectUrls", "rsProtect" })
@Test
public void test(String host, String opHost, String redirectUrls, String rsProtect) throws IOException {
ClientInterface client = Tester.newClient(host);
RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, redirectUrls);
final RpGetRptResponse rptResponse = RpGetRptTest.requestRpt(client, site, rsProtect);
IntrospectRptParams params = new IntrospectRptParams();
params.setRpId(site.getRpId());
params.setRpt(rptResponse.getRpt());
final CorrectRptIntrospectionResponse response = client.introspectRpt(Tester.getAuthorization(site), null, params);
assertNotNull(response);
assertTrue(response.getActive());
assertTrue(response.getExpiresAt() != null);
assertTrue(response.getIssuedAt() != null);
}
Aggregations