Home > other >  Whether to support rewrite AuthorizationEndpoint oauth2 authorization code mode, and rewrite the ent
Whether to support rewrite AuthorizationEndpoint oauth2 authorization code mode, and rewrite the ent

Time:11-29




I have found the use authorization code mode, after enter the url will be into the
@ RequestMapping ({} "/request/the authorize")
Public ModelAndView the authorize (Map The model, the @ RequestParam Map The parameters, SessionStatus SessionStatus, Principal Principal) {
AuthorizationRequest AuthorizationRequest=this. GetOAuth2RequestFactory (.) createAuthorizationRequest (parameters);
The Set responseTypes=authorizationRequest. GetResponseTypes ();
if(! ResponseTypes. The contains (" token ") & amp; & ! ResponseTypes. The contains (" code ")) {
Throw new UnsupportedResponseTypeException (" Unsupported response types: "+ responseTypes);
} else if (authorizationRequest getClientId ()==null) {
Throw new InvalidClientException (" A client id must be provided ");
} else {
Try {
If (principal instanceof Authentication & amp; & ((Authentication) principal). IsAuthenticated ()) {
ClientDetails e=this. GetClientDetailsService (.) loadClientByClientId (authorizationRequest. GetClientId ());
String redirectUriParameter=(String) authorizationRequest. GetRequestParameters () get (" redirect_uri ");
String resolvedRedirect=this. RedirectResolver. ResolveRedirect (redirectUriParameter, e);
if(! StringUtils. HasText (resolvedRedirect)) {
Throw new RedirectMismatchException (" A redirectUri must be either supplied or preconfigured in the ClientDetails ");
} else {
AuthorizationRequest. SetRedirectUri (resolvedRedirect);
This. Oauth2RequestValidator. ValidateScope (authorizationRequest, e);
AuthorizationRequest=this. UserApprovalHandler. CheckForPreApproval (authorizationRequest, (Authentication) principal);
Boolean approved=this. UserApprovalHandler. IsApproved (authorizationRequest, (Authentication) principal);
AuthorizationRequest. SetApproved (approved);
If (authorizationRequest isApproved ()) {
If (responseTypes. The contains (" token ")) {
Return this. GetImplicitGrantResponse (authorizationRequest);
}

If (responseTypes. The contains (" code ")) {
Return new ModelAndView (enclosing getAuthorizationCodeResponse (authorizationRequest, (Authentication) principal));
}
}

Model. The put (" authorizationRequest authorizationRequest);
Return this. GetUserApprovalPageResponse (model, authorizationRequest, (Authentication) principal);
}
} else {
Throw new InsufficientAuthenticationException (" the User must be authenticated with Spring Security before authorization can be completed. ");
}
{} the catch (RuntimeException var11)
SessionStatus. SetComplete ();
Throw var11;
}
}
}
The inside, but this method of rewriting AuthorizationEndpoint? Where have to rewrite the entrance?

CodePudding user response:

The building Lord solved?
  • Related