use of org.apache.wink.client.ClientConfig in project product-is by wso2.
the class OIDCDiscoveryTestCase method testDiscovery.
@Test(alwaysRun = true, groups = "wso2.is", description = "Discovery test", dependsOnMethods = { "testWebFinger" })
public void testDiscovery() throws IOException {
ClientConfig clientConfig = new ClientConfig();
BasicAuthSecurityHandler basicAuth = new BasicAuthSecurityHandler();
basicAuth.setUserName(userInfo.getUserName());
basicAuth.setPassword(userInfo.getPassword());
clientConfig.handlers(basicAuth);
RestClient restClient = new RestClient(clientConfig);
String discoveryUrl = isServerBackendUrl + "/oauth2/oidcdiscovery/.well-known/openid-configuration";
Resource userResource = restClient.resource(discoveryUrl);
String response = userResource.accept(SCIMConstants.APPLICATION_JSON).get(String.class);
Object obj = JSONValue.parse(response);
String authorization_endpoint = ((JSONObject) obj).get("authorization_endpoint").toString();
Assert.assertEquals(authorization_endpoint, isServerBackendUrl + "/oauth2/authorize");
String token_endpoint = ((JSONObject) obj).get("token_endpoint").toString();
Assert.assertEquals(token_endpoint, isServerBackendUrl + "/oauth2/token");
String userinfo_endpoint = ((JSONObject) obj).get("userinfo_endpoint").toString();
Assert.assertEquals(userinfo_endpoint, isServerBackendUrl + "/oauth2/userinfo");
}
Aggregations