use of io.jans.ca.common.params.GetUserInfoParams in project jans by JanssenProject.
the class DifferentAuthServerTest method getUserInfo_withDifferentAuthServer.
@Parameters({ "host", "opHost", "authServer", "redirectUrls", "clientId", "clientSecret", "userId", "userSecret" })
@Test
public void getUserInfo_withDifferentAuthServer(String host, String opHost, String authServer, String redirectUrls, String clientId, String clientSecret, String userId, String userSecret) {
ClientInterface client = Tester.newClient(host);
RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, redirectUrls);
RegisterSiteResponse authServerResp = RegisterSiteTest.registerSite(client, authServer, redirectUrls);
final GetTokensByCodeResponse2 tokens = requestTokens(client, opHost, site, authServerResp, userId, userSecret, site.getClientId(), redirectUrls);
GetUserInfoParams params = new GetUserInfoParams();
params.setRpId(site.getRpId());
params.setAccessToken(tokens.getAccessToken());
params.setIdToken(tokens.getIdToken());
final JsonNode resp = client.getUserInfo(Tester.getAuthorization(authServerResp), authServerResp.getRpId(), params);
assertNotNull(resp);
assertNotNull(resp.get("sub"));
}
use of io.jans.ca.common.params.GetUserInfoParams in project jans by JanssenProject.
the class GetUserInfoTest method test.
@Parameters({ "host", "opHost", "redirectUrls", "userId", "userSecret" })
@Test
public void test(String host, String opHost, String redirectUrls, String userId, String userSecret) {
ClientInterface client = Tester.newClient(host);
final RegisterSiteResponse site = RegisterSiteTest.registerSite(client, opHost, redirectUrls);
final GetTokensByCodeResponse2 tokens = requestTokens(client, opHost, site, userId, userSecret, site.getClientId(), redirectUrls);
GetUserInfoParams params = new GetUserInfoParams();
params.setRpId(site.getRpId());
params.setAccessToken(tokens.getAccessToken());
params.setIdToken(tokens.getIdToken());
final JsonNode resp = client.getUserInfo(Tester.getAuthorization(site), null, params);
assertNotNull(resp);
assertNotNull(resp.get("sub"));
}
Aggregations