congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
OidcAuthorizationCodeAuthenticationProvider.setAuthoritiesMapper
Code IndexAdd Tabnine to your IDE (free)

How to use
setAuthoritiesMapper
method
in
org.springframework.security.oauth2.client.oidc.authentication.OidcAuthorizationCodeAuthenticationProvider

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

origin: spring-projects/spring-security

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

@Test
public void authenticateWhenAuthoritiesMapperSetThenReturnMappedAuthorities() {
  Map<String, Object> claims = new HashMap<>();
  claims.put(IdTokenClaimNames.ISS, "https://provider.com");
  claims.put(IdTokenClaimNames.SUB, "subject1");
  claims.put(IdTokenClaimNames.AUD, Arrays.asList("client1", "client2"));
  claims.put(IdTokenClaimNames.AZP, "client1");
  this.setUpIdToken(claims);
  OidcUser principal = mock(OidcUser.class);
  List<GrantedAuthority> authorities = AuthorityUtils.createAuthorityList("ROLE_USER");
  when(principal.getAuthorities()).thenAnswer(
    (Answer<List<GrantedAuthority>>) invocation -> authorities);
  when(this.userService.loadUser(any())).thenReturn(principal);
  List<GrantedAuthority> mappedAuthorities = AuthorityUtils.createAuthorityList("ROLE_OIDC_USER");
  GrantedAuthoritiesMapper authoritiesMapper = mock(GrantedAuthoritiesMapper.class);
  when(authoritiesMapper.mapAuthorities(anyCollection())).thenAnswer(
    (Answer<List<GrantedAuthority>>) invocation -> mappedAuthorities);
  this.authenticationProvider.setAuthoritiesMapper(authoritiesMapper);
  OAuth2LoginAuthenticationToken authentication =
    (OAuth2LoginAuthenticationToken) this.authenticationProvider.authenticate(
      new OAuth2LoginAuthenticationToken(this.clientRegistration, this.authorizationExchange));
  assertThat(authentication.getAuthorities()).isEqualTo(mappedAuthorities);
}
origin: spring-projects/spring-security

oidcAuthorizationCodeAuthenticationProvider.setAuthoritiesMapper(userAuthoritiesMapper);
origin: org.springframework.security/spring-security-config

  new OidcAuthorizationCodeAuthenticationProvider(accessTokenResponseClient, oidcUserService);
if (userAuthoritiesMapper != null) {
  oidcAuthorizationCodeAuthenticationProvider.setAuthoritiesMapper(userAuthoritiesMapper);
origin: apache/servicemix-bundles

  new OidcAuthorizationCodeAuthenticationProvider(accessTokenResponseClient, oidcUserService);
if (userAuthoritiesMapper != null) {
  oidcAuthorizationCodeAuthenticationProvider.setAuthoritiesMapper(userAuthoritiesMapper);
org.springframework.security.oauth2.client.oidc.authenticationOidcAuthorizationCodeAuthenticationProvidersetAuthoritiesMapper

Javadoc

Sets the GrantedAuthoritiesMapper used for mapping OidcUser#getAuthorities()} to a new set of authorities which will be associated to the OAuth2LoginAuthenticationToken.

Popular methods of OidcAuthorizationCodeAuthenticationProvider

  • <init>
  • createOidcToken
  • setJwtDecoderFactory
    Sets the JwtDecoderFactory used for OidcIdToken signature verification. The factory returns a JwtDec
  • authenticate
  • getJwtDecoder
  • supports

Popular in Java

  • Finding current android device location
  • putExtra (Intent)
  • getContentResolver (Context)
  • scheduleAtFixedRate (Timer)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • Top 17 PhpStorm Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now