Java Code Examples for org.gluu.oxauth.client.UserInfoClient#exec()

The following examples show how to use org.gluu.oxauth.client.UserInfoClient#exec() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UserInfoAction.java    From oxAuth with MIT License 6 votes vote down vote up
public void exec() {
    try {
        UserInfoRequest request = new UserInfoRequest(accessToken);
        request.setAuthorizationMethod(authorizationMethod);

        UserInfoClient client = new UserInfoClient(userInfoEndpoint);
        client.setRequest(request);
        client.exec();

        showResults = true;
        requestString = client.getRequestAsString();
        responseString = client.getResponseAsString();
    } catch (Exception e) {
    	log.error(e.getMessage(), e);
    }
}
 
Example 2
Source File: GetUserInfoOperation.java    From oxd with Apache License 2.0 6 votes vote down vote up
@Override
public IOpResponse execute(GetUserInfoParams params) throws IOException {
    getValidationService().validate(params);

    UserInfoClient client = getOpClientFactory().createUserInfoClient(getDiscoveryService().getConnectDiscoveryResponseByOxdId(params.getOxdId()).getUserInfoEndpoint());
    client.setExecutor(getHttpService().getClientExecutor());
    client.setRequest(new UserInfoRequest(params.getAccessToken()));

    final UserInfoResponse response = client.exec();
    //validate subject identifier of successful response
    if (response.getStatus() == 200) {
        validateSubjectIdentifier(params.getIdToken(), response);
    }

    return new POJOResponse(Jackson2.createJsonMapper().readTree(response.getEntity()));
}