public OAuth2LoginReactiveAuthenticationManager( ReactiveOAuth2AccessTokenResponseClient<OAuth2AuthorizationCodeGrantRequest> accessTokenResponseClient, ReactiveOAuth2UserService<OAuth2UserRequest, OAuth2User> userService) { Assert.notNull(accessTokenResponseClient, "accessTokenResponseClient cannot be null"); Assert.notNull(userService, "userService cannot be null"); this.authorizationCodeManager = new OAuth2AuthorizationCodeReactiveAuthenticationManager(accessTokenResponseClient); this.userService = userService; }
@Override public Mono<Authentication> authenticate(Authentication authentication) { return Mono.defer(() -> { OAuth2AuthorizationCodeAuthenticationToken token = (OAuth2AuthorizationCodeAuthenticationToken) authentication; OAuth2AuthorizationExchangeValidator.validate(token.getAuthorizationExchange()); OAuth2AuthorizationCodeGrantRequest authzRequest = new OAuth2AuthorizationCodeGrantRequest( token.getClientRegistration(), token.getAuthorizationExchange()); return this.accessTokenResponseClient.getTokenResponse(authzRequest) .map(onSuccess(token)); }); }
private OAuth2AuthorizationCodeAuthenticationToken authenticate() { OAuth2AuthorizationExchange exchange = new OAuth2AuthorizationExchange( this.authorizationRequest.build(), this.authorizationResponse.build()); OAuth2AuthorizationCodeAuthenticationToken token = new OAuth2AuthorizationCodeAuthenticationToken( this.registration.build(), exchange); return (OAuth2AuthorizationCodeAuthenticationToken) this.manager.authenticate(token).block(); } }
@Override public Mono<Authentication> authenticate(Authentication authentication) { return Mono.defer(() -> { OAuth2AuthorizationCodeAuthenticationToken token = (OAuth2AuthorizationCodeAuthenticationToken) authentication; OAuth2AuthorizationExchangeValidator.validate(token.getAuthorizationExchange()); OAuth2AuthorizationCodeGrantRequest authzRequest = new OAuth2AuthorizationCodeGrantRequest( token.getClientRegistration(), token.getAuthorizationExchange()); return this.accessTokenResponseClient.getTokenResponse(authzRequest) .map(onSuccess(token)); }); }
/** * Gets the {@link ReactiveAuthenticationManager} to use. First tries an explicitly configured manager, and * defaults to {@link OAuth2AuthorizationCodeReactiveAuthenticationManager} * * @return the {@link ReactiveAuthenticationManager} to use */ private ReactiveAuthenticationManager getAuthenticationManager() { if (this.authenticationManager == null) { this.authenticationManager = new OAuth2AuthorizationCodeReactiveAuthenticationManager(new WebClientReactiveAuthorizationCodeTokenResponseClient()); } return this.authenticationManager; }
@Before public void setup() { this.manager = new OAuth2AuthorizationCodeReactiveAuthenticationManager(this.accessTokenResponseClient); }
/** * Gets the {@link ReactiveAuthenticationManager} to use. First tries an explicitly configured manager, and * defaults to {@link OAuth2AuthorizationCodeReactiveAuthenticationManager} * * @return the {@link ReactiveAuthenticationManager} to use */ private ReactiveAuthenticationManager getAuthenticationManager() { if (this.authenticationManager == null) { this.authenticationManager = new OAuth2AuthorizationCodeReactiveAuthenticationManager(new WebClientReactiveAuthorizationCodeTokenResponseClient()); } return this.authenticationManager; }
public OAuth2LoginReactiveAuthenticationManager( ReactiveOAuth2AccessTokenResponseClient<OAuth2AuthorizationCodeGrantRequest> accessTokenResponseClient, ReactiveOAuth2UserService<OAuth2UserRequest, OAuth2User> userService) { Assert.notNull(accessTokenResponseClient, "accessTokenResponseClient cannot be null"); Assert.notNull(userService, "userService cannot be null"); this.authorizationCodeManager = new OAuth2AuthorizationCodeReactiveAuthenticationManager(accessTokenResponseClient); this.userService = userService; }
/** * Gets the {@link ReactiveAuthenticationManager} to use. First tries an explicitly configured manager, and * defaults to {@link OAuth2AuthorizationCodeReactiveAuthenticationManager} * * @return the {@link ReactiveAuthenticationManager} to use */ private ReactiveAuthenticationManager getAuthenticationManager() { if (this.authenticationManager == null) { this.authenticationManager = new OAuth2AuthorizationCodeReactiveAuthenticationManager(new WebClientReactiveAuthorizationCodeTokenResponseClient()); } return this.authenticationManager; }