Codota Logo
org.springframework.security.oauth2.client.authentication
Code IndexAdd Codota to your IDE (free)

How to use org.springframework.security.oauth2.client.authentication

Best Java code snippets using org.springframework.security.oauth2.client.authentication (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Point p =
  • Codota Iconnew Point(x, y)
  • Codota Iconnew Point()
  • Codota IconMouseEvent e;e.getPoint()
  • Smart code suggestions by Codota
}
origin: spring-projects/spring-security

@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));
  });
}
origin: spring-projects/spring-security

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;
}
origin: spring-projects/spring-security

public OAuth2AuthorizationCodeAuthenticationToken(ClientRegistration clientRegistration, OAuth2AuthorizationExchange authorizationExchange, OAuth2AccessToken accessToken, OAuth2RefreshToken refreshToken,
    Map<String, Object> additionalParameters) {
  this(clientRegistration, authorizationExchange);
  Assert.notNull(accessToken, "accessToken cannot be null");
  this.accessToken = accessToken;
  this.refreshToken = refreshToken;
  this.setAuthenticated(true);
  this.additionalParameters.putAll(additionalParameters);
}
origin: spring-projects/spring-security

  private Function<OAuth2AccessTokenResponse, OAuth2AuthorizationCodeAuthenticationToken> onSuccess(OAuth2AuthorizationCodeAuthenticationToken token) {
    return accessTokenResponse -> {
      ClientRegistration registration = token.getClientRegistration();
      OAuth2AuthorizationExchange exchange = token.getAuthorizationExchange();
      OAuth2AccessToken accessToken = accessTokenResponse.getAccessToken();
      OAuth2RefreshToken refreshToken = accessTokenResponse.getRefreshToken();
      return new OAuth2AuthorizationCodeAuthenticationToken(registration, exchange, accessToken, refreshToken, accessTokenResponse.getAdditionalParameters());
    };
  }
}
origin: spring-projects/spring-security

@Test(expected = IllegalArgumentException.class)
public void constructorTokenRequestResponseWhenPrincipalIsNullThenThrowIllegalArgumentException() {
  new OAuth2LoginAuthenticationToken(this.clientRegistration, this.authorizationExchange, null,
    this.authorities, this.accessToken);
}
origin: spring-projects/spring-security

@Test
public void constructorWhenAuthoritiesIsNullThenCreated() {
  new OAuth2AuthenticationToken(this.principal, null, this.authorizedClientRegistrationId);
}
origin: spring-projects/spring-security

@Before
public void setup() {
  this.manager = new OAuth2LoginReactiveAuthenticationManager(this.accessTokenResponseClient, this.userService);
}
origin: spring-projects/spring-security

@Test
public void constructorWhenAccessTokenResponseClientIsNullThenThrowIllegalArgumentException() {
  this.exception.expect(IllegalArgumentException.class);
  new OAuth2LoginAuthenticationProvider(null, this.userService);
}
origin: spring-projects/spring-security

@Test
public void setAuthoritiesMapperWhenAuthoritiesMapperIsNullThenThrowIllegalArgumentException() {
  this.exception.expect(IllegalArgumentException.class);
  this.authenticationProvider.setAuthoritiesMapper(null);
}
origin: spring-projects/spring-security

@Test(expected = IllegalArgumentException.class)
public void constructorTokenRequestResponseWhenAuthorizationExchangeIsNullThenThrowIllegalArgumentException() {
  new OAuth2LoginAuthenticationToken(this.clientRegistration, null, this.principal,
    this.authorities, this.accessToken);
}
origin: spring-projects/spring-security

/**
 * 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;
}
origin: spring-projects/spring-security

@Test(expected = IllegalArgumentException.class)
public void constructorWhenAuthorizedClientRegistrationIdIsNullThenThrowIllegalArgumentException() {
  new OAuth2AuthenticationToken(this.principal, this.authorities, null);
}
origin: spring-projects/spring-security

@Test(expected = IllegalArgumentException.class)
public void constructorTokenRequestResponseWhenClientRegistrationIsNullThenThrowIllegalArgumentException() {
  new OAuth2LoginAuthenticationToken(null, this.authorizationExchange, this.principal,
    this.authorities, this.accessToken);
}
origin: spring-projects/spring-security

@Before
public void setup() {
  this.manager = new OAuth2AuthorizationCodeReactiveAuthenticationManager(this.accessTokenResponseClient);
}
origin: spring-projects/spring-security

@Test(expected = IllegalArgumentException.class)
public void constructorWhenPrincipalIsNullThenThrowIllegalArgumentException() {
  new OAuth2AuthenticationToken(null, this.authorities, this.authorizedClientRegistrationId);
}
origin: spring-projects/spring-security

@Test(expected = IllegalArgumentException.class)
public void constructorAuthorizationRequestResponseWhenAuthorizationExchangeIsNullThenThrowIllegalArgumentException() {
  new OAuth2LoginAuthenticationToken(this.clientRegistration, null);
}
origin: spring-projects/spring-security

@Test(expected = IllegalArgumentException.class)
public void constructorAuthorizationRequestResponseWhenClientRegistrationIsNullThenThrowIllegalArgumentException() {
  new OAuth2LoginAuthenticationToken(null, this.authorizationExchange);
}
origin: spring-projects/spring-security

@Test(expected = IllegalArgumentException.class)
public void constructorTokenRequestResponseWhenAccessTokenIsNullThenThrowIllegalArgumentException() {
  new OAuth2LoginAuthenticationToken(this.clientRegistration, this.authorizationExchange, this.principal,
    this.authorities, null);
}
origin: spring-projects/spring-security

@Test
public void constructorTokenRequestResponseWhenAuthoritiesIsNullThenCreated() {
  new OAuth2LoginAuthenticationToken(this.clientRegistration, this.authorizationExchange,
    this.principal, null, this.accessToken);
}
origin: spring-projects/spring-security

@Test
public void constructorTokenRequestResponseWhenAuthoritiesIsEmptyThenCreated() {
  new OAuth2LoginAuthenticationToken(this.clientRegistration, this.authorizationExchange,
    this.principal, Collections.emptyList(), this.accessToken);
}
org.springframework.security.oauth2.client.authentication

Most used classes

  • OAuth2AuthenticationToken
  • OAuth2LoginAuthenticationToken
    An AbstractAuthenticationToken for OAuth 2.0 Login, which leverages the OAuth 2.0 Authorization Code
  • OAuth2AuthorizationCodeReactiveAuthenticationManager
  • OAuth2AuthorizationCodeAuthenticationToken
    An AbstractAuthenticationToken for the OAuth 2.0 Authorization Code Grant.
  • OAuth2LoginAuthenticationProvider
    An implementation of an AuthenticationProvider for OAuth 2.0 Login, which leverages the OAuth 2.0 Au
  • OAuth2AuthorizationExchangeValidator,
  • OAuth2AuthorizationCodeAuthenticationProvider,
  • OAuth2AuthorizationCodeReactiveAuthenticationManagerTests,
  • OAuth2LoginAuthenticationProviderTests,
  • OAuth2LoginReactiveAuthenticationManagerTests,
  • TestOAuth2AuthorizationCodeAuthenticationTokens
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now