private AuthorizationRequest getAuthorizationRequestForError(ServletWebRequest webRequest) { // If it's already there then we are in the approveOrDeny phase and we can use the saved request AuthorizationRequest authorizationRequest = (AuthorizationRequest) sessionAttributeStore.retrieveAttribute( webRequest, AUTHORIZATION_REQUEST_ATTR_NAME); if (authorizationRequest != null) { return authorizationRequest; } Map<String, String> parameters = new HashMap<String, String>(); Map<String, String[]> map = webRequest.getParameterMap(); for (String key : map.keySet()) { String[] values = map.get(key); if (values != null && values.length > 0) { parameters.put(key, values[0]); } } try { return getOAuth2RequestFactory().createAuthorizationRequest(parameters); } catch (Exception e) { return getDefaultOAuth2RequestFactory().createAuthorizationRequest(parameters); } } }
private AuthorizationRequest getAuthorizationRequestForError(ServletWebRequest webRequest) { // If it's already there then we are in the approveOrDeny phase and we can use the saved request AuthorizationRequest authorizationRequest = (AuthorizationRequest) sessionAttributeStore.retrieveAttribute( webRequest, AUTHORIZATION_REQUEST); if (authorizationRequest != null) { return authorizationRequest; } Map<String, String> parameters = new HashMap<String, String>(); Map<String, String[]> map = webRequest.getParameterMap(); for (String key : map.keySet()) { String[] values = map.get(key); if (values != null && values.length > 0) { parameters.put(key, values[0]); } } try { return getOAuth2RequestFactory().createAuthorizationRequest(parameters); } catch (Exception e) { return getDefaultOAuth2RequestFactory().createAuthorizationRequest(parameters); } }
AuthorizationRequest authorizationRequest = oAuth2RequestFactory.createAuthorizationRequest(map);
authRequest = authRequestFactory.createAuthorizationRequest(createRequestMap(request.getParameterMap())); if (!Strings.isNullOrEmpty(authRequest.getClientId())) { client = clientService.loadClientByClientId(authRequest.getClientId());
AuthorizationRequest authorizationRequest = oAuth2RequestFactory.createAuthorizationRequest(dc.getRequestParameters());
AuthorizationRequest authorizationRequest = oAuth2RequestFactory.createAuthorizationRequest(map);
AuthorizationRequest authorizationRequest = getOAuth2RequestFactory().createAuthorizationRequest(parameters);
authorizationRequest = getOAuth2RequestFactory().createAuthorizationRequest(parameters); } catch (DisallowedIdpException x) { return switchIdp(model, client, clientId, request);
/** * Create authorization request authorization request. * * @param request the request * @return the authorization request */ private AuthorizationRequest createAuthorizationRequest(final HttpServletRequest request) { log.debug("Constructing authorization request"); final Map<String, String> requestParameters = createRequestMap(request.getParameterMap()); return authRequestFactory.createAuthorizationRequest(requestParameters); }
private AuthorizationRequest getAuthorizationRequestForError(ServletWebRequest webRequest) { // If it's already there then we are in the approveOrDeny phase and we can use the saved request AuthorizationRequest authorizationRequest = (AuthorizationRequest) sessionAttributeStore.retrieveAttribute( webRequest, AUTHORIZATION_REQUEST_ATTR_NAME); if (authorizationRequest != null) { return authorizationRequest; } Map<String, String> parameters = new HashMap<String, String>(); Map<String, String[]> map = webRequest.getParameterMap(); for (String key : map.keySet()) { String[] values = map.get(key); if (values != null && values.length > 0) { parameters.put(key, values[0]); } } try { return getOAuth2RequestFactory().createAuthorizationRequest(parameters); } catch (Exception e) { return getDefaultOAuth2RequestFactory().createAuthorizationRequest(parameters); } } }
authorizationParameters.put(OAuth2Utils.REDIRECT_URI, redirectUri); AuthorizationRequest authorizationRequest = getOAuth2RequestFactory().createAuthorizationRequest(authorizationParameters);
AuthorizationRequest authorizationRequest = oAuth2RequestFactory.createAuthorizationRequest(map);
authRequest = authRequestFactory.createAuthorizationRequest(createRequestMap(request.getParameterMap())); if (!Strings.isNullOrEmpty(authRequest.getClientId())) { client = clientService.loadClientByClientId(authRequest.getClientId());
private String generateCode(Customer customer) throws AuthenticationException { final String clientId = ((OAuth2Authentication) getContext().getAuthentication()) .getOAuth2Request().getClientId(); final OAuth2RequestFactory oAuth2RequestFactory = authorizationServerEndpointsConfiguration .getEndpointsConfigurer() .getOAuth2RequestFactory(); final OAuth2Request storedOAuth2Request = oAuth2RequestFactory.createOAuth2Request( oAuth2RequestFactory.createAuthorizationRequest( ImmutableMap.<String, String>builder() .put(OAuth2Utils.SCOPE, Scope.CUSTOMER.toString()) .put(OAuth2Utils.CLIENT_ID, clientId) .build() ) ); final UserDetails customerUserDetails = customerUserDetailsService.createCustomerUserDetails(customer); final OAuth2Authentication combinedAuth = new OAuth2Authentication(storedOAuth2Request, new SiteAuthenticationToken(customerUserDetails, null, customerUserDetails.getAuthorities() )); return authorizationCodeServices.createAuthorizationCode(combinedAuth); } }
public OAuth2Request validateCredentials(String grantType, TokenRequest tokenRequest) { String clientId = tokenRequest.getClientId(); String scopesString = tokenRequest.getRequestParameters().get(OrcidOauth2Constants.SCOPE_PARAM); Set<String> scopes = new HashSet<String>(); if(!PojoUtil.isEmpty(scopesString)) { scopes = OAuth2Utils.parseParameterList(scopesString); } ClientDetailsEntity clientDetails = clientDetailsEntityCacheManager.retrieve(clientId); orcidOAuth2RequestValidator.validateClientIsEnabled(clientDetails); validateGrantType(grantType, clientDetails); if (scopes != null) { validateScope(clientDetails, scopes); } Map<String, String> authorizationParams = new HashMap<String, String>(); authorizationParams.putAll(tokenRequest.getRequestParameters()); authorizationParams.put(OrcidOauth2Constants.GRANT_TYPE, grantType); authorizationParams.put(OAuth2Utils.SCOPE, StringUtils.join(scopes, ' ')); authorizationParams.put(OAuth2Utils.CLIENT_ID, clientId); AuthorizationRequest authorizationRequest = oAuth2RequestFactory.createAuthorizationRequest(authorizationParams); authorizationRequest.setAuthorities(clientDetails.getAuthorities()); authorizationRequest.setResourceIds(clientDetails.getResourceIds()); authorizationRequest.setApproved(true); return oAuth2RequestFactory.createOAuth2Request(authorizationRequest); }
AuthorizationRequest authorizationRequest = oAuth2RequestFactory.createAuthorizationRequest(dc.getRequestParameters());
AuthorizationRequest authorizationRequest = getOAuth2RequestFactory().createAuthorizationRequest(parameters);