UaaAuthorizationEndpoint extends AbstractEndpoint implements AuthenticationEntryPoint { protected String deriveGrantTypeFromResponseType(Set<String> responseTypes) { if (responseTypes.contains("token")) { return GRANT_TYPE_IMPLICIT; } else if (responseTypes.size() == 1 && responseTypes.contains("id_token")) { return GRANT_TYPE_IMPLICIT; } return GRANT_TYPE_AUTHORIZATION_CODE; } UaaAuthorizationEndpoint(
            final RedirectResolver redirectResolver,
            final @Qualifier("userManagedApprovalHandler") UserApprovalHandler userApprovalHandler,
            final @Qualifier("oauth2RequestValidator") OAuth2RequestValidator oauth2RequestValidator,
            final @Qualifier("authorizationCodeServices") AuthorizationCodeServices authorizationCodeServices,
            final @Qualifier("hybridTokenGranterForAuthCodeGrant") HybridTokenGranterForAuthorizationCode hybridTokenGranterForAuthCode,
            final @Qualifier("openIdSessionStateCalculator") OpenIdSessionStateCalculator openIdSessionStateCalculator,
            final @Qualifier("authorizationRequestManager") OAuth2RequestFactory oAuth2RequestFactory,
            final @Qualifier("jdbcClientDetailsService") MultitenantClientServices clientDetailsService,
            final @Qualifier("oauth2TokenGranter") TokenGranter tokenGranter); @RequestMapping(value = "/oauth/authorize") ModelAndView authorize(Map<String, Object> model,
                                  @RequestParam Map<String, String> parameters,
                                  SessionStatus sessionStatus,
                                  Principal principal,
                                  HttpServletRequest request); @Override void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException); @RequestMapping(value = "/oauth/authorize", method = RequestMethod.POST, params = OAuth2Utils.USER_OAUTH_APPROVAL) View approveOrDeny(@RequestParam Map<String, String> approvalParameters, Map<String, ?> model,
                              SessionStatus sessionStatus, Principal principal); String buildRedirectURI(AuthorizationRequest authorizationRequest,
                                   OAuth2AccessToken accessToken,
                                   Authentication authUser); @SuppressWarnings("deprecation") void setImplicitGrantService(org.springframework.security.oauth2.provider.implicit.ImplicitGrantService implicitGrantService); @ExceptionHandler(ClientRegistrationException.class) ModelAndView handleClientRegistrationException(Exception e, ServletWebRequest webRequest); @ExceptionHandler(OAuth2Exception.class) ModelAndView handleOAuth2Exception(OAuth2Exception e, ServletWebRequest webRequest); @ExceptionHandler(HttpSessionRequiredException.class) ModelAndView handleHttpSessionRequiredException(HttpSessionRequiredException e, ServletWebRequest webRequest); static final String AUTHORIZATION_REQUEST; static final String ORIGINAL_AUTHORIZATION_REQUEST; }
@Test public void testGetGrantType_id_token_only_is_implicit() { responseTypes.add("id_token"); assertEquals(GRANT_TYPE_IMPLICIT, uaaAuthorizationEndpoint.deriveGrantTypeFromResponseType(responseTypes)); }
@Test public void testGetGrantType_token_as_response_is_implcit() { responseTypes.add("token"); assertEquals(GRANT_TYPE_IMPLICIT, uaaAuthorizationEndpoint.deriveGrantTypeFromResponseType(responseTypes)); }
@Test public void testGetGrantType_code_is_auth_code() { responseTypes.add("code"); assertEquals(GRANT_TYPE_AUTHORIZATION_CODE, uaaAuthorizationEndpoint.deriveGrantTypeFromResponseType(responseTypes)); }
@Test public void testGetGrantType_code_and_token_is_implicit() { responseTypes.add("code"); responseTypes.add("token"); assertEquals(GRANT_TYPE_IMPLICIT, uaaAuthorizationEndpoint.deriveGrantTypeFromResponseType(responseTypes)); }
@Test public void testGetGrantType_id_token_and_token_is_implicit() { responseTypes.add("id_token"); responseTypes.add("token"); assertEquals(GRANT_TYPE_IMPLICIT, uaaAuthorizationEndpoint.deriveGrantTypeFromResponseType(responseTypes)); }
@Test public void testGetGrantType_code_and_id_token_is_authorization_code() { responseTypes.add("code"); responseTypes.add("id_token"); assertEquals(GRANT_TYPE_AUTHORIZATION_CODE, uaaAuthorizationEndpoint.deriveGrantTypeFromResponseType(responseTypes)); }
@Test public void testGetGrantType_code_id_token_and_token_is_implicit() { responseTypes.add("code"); responseTypes.add("id_token"); responseTypes.add("token"); assertEquals(GRANT_TYPE_IMPLICIT, uaaAuthorizationEndpoint.deriveGrantTypeFromResponseType(responseTypes)); }