Example usage for org.springframework.security.oauth2.client.resource UserApprovalRequiredException UserApprovalRequiredException

List of usage examples for org.springframework.security.oauth2.client.resource UserApprovalRequiredException UserApprovalRequiredException

Introduction

In this page you can find the example usage for org.springframework.security.oauth2.client.resource UserApprovalRequiredException UserApprovalRequiredException.

Prototype

public UserApprovalRequiredException(String approvalUri, Map<String, String> parameters, String clientId,
            List<String> scope) 

Source Link

Usage

From source file:com.zhm.config.MyAuthorizationCodeAccessTokenProvider.java

protected UserApprovalRequiredException getUserApprovalSignal(AuthorizationCodeResourceDetails resource,
        AccessTokenRequest request) {/*from w w  w  .  j  av a 2 s  .  c o  m*/
    String message = String.format("Do you approve the client '%s' to access your resources with scope=%s",
            resource.getClientId(), resource.getScope());
    return new UserApprovalRequiredException(resource.getUserAuthorizationUri(),
            Collections.singletonMap(OAuth2Utils.USER_OAUTH_APPROVAL, message), resource.getClientId(),
            resource.getScope());
}

From source file:com.emergya.spring.security.oauth.google.GoogleAuthorizationCodeAccessTokenProvider.java

/**
 * Gets the content for the UserApprovalRequire exeption.
 *
 * @param resource the resource details objet
 * @param request the access toke request
 * @return the exception to be thrown//  w  ww.j  av a 2s  .  c o  m
 */
protected final UserApprovalRequiredException getUserApprovalSignal(AuthorizationCodeResourceDetails resource,
        AccessTokenRequest request) {
    String message = String.format("Do you approve the client '%s' to access your resources with scope=%s",
            resource.getClientId(), resource.getScope());
    return new UserApprovalRequiredException(resource.getUserAuthorizationUri(),
            Collections.singletonMap(OAuth2Utils.USER_OAUTH_APPROVAL, message), resource.getClientId(),
            resource.getScope());
}