congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
HttpSecurityBuilder.authenticationProvider
Code IndexAdd Tabnine to your IDE (free)

How to use
authenticationProvider
method
in
org.springframework.security.config.annotation.web.HttpSecurityBuilder

Best Java code snippets using org.springframework.security.config.annotation.web.HttpSecurityBuilder.authenticationProvider (Showing top 20 results out of 315)

origin: spring-projects/spring-security

@Override
public void init(H http) throws Exception {
  if (authenticationProvider == null) {
    authenticationProvider = new AnonymousAuthenticationProvider(getKey());
  }
  if (authenticationFilter == null) {
    authenticationFilter = new AnonymousAuthenticationFilter(getKey(), principal,
        authorities);
  }
  authenticationProvider = postProcess(authenticationProvider);
  http.authenticationProvider(authenticationProvider);
}
origin: spring-projects/spring-security

@Override
public void init(H http) throws Exception {
  PreAuthenticatedAuthenticationProvider authenticationProvider = new PreAuthenticatedAuthenticationProvider();
  authenticationProvider.setPreAuthenticatedUserDetailsService(getAuthenticationUserDetailsService(http));
  http
    .authenticationProvider(authenticationProvider)
    .setSharedObject(AuthenticationEntryPoint.class, new Http403ForbiddenEntryPoint());
}
// @formatter:on
origin: spring-projects/spring-security

@Override
public void init(H http) throws Exception {
  super.init(http);
  OpenIDAuthenticationProvider authenticationProvider = new OpenIDAuthenticationProvider();
  authenticationProvider.setAuthenticationUserDetailsService(
      getAuthenticationUserDetailsService(http));
  authenticationProvider = postProcess(authenticationProvider);
  http.authenticationProvider(authenticationProvider);
  initDefaultLoginFilter(http);
}
origin: spring-projects/spring-security

/**
 * Populates a {@link PreAuthenticatedAuthenticationProvider} into
 * {@link HttpSecurity#authenticationProvider(org.springframework.security.authentication.AuthenticationProvider)}
 * and a {@link Http403ForbiddenEntryPoint} into
 * {@link HttpSecurityBuilder#setSharedObject(Class, Object)}
 *
 * @see org.springframework.security.config.annotation.SecurityConfigurerAdapter#init(org.springframework.security.config.annotation.SecurityBuilder)
 */
@Override
public void init(H http) throws Exception {
  PreAuthenticatedAuthenticationProvider authenticationProvider = new PreAuthenticatedAuthenticationProvider();
  authenticationProvider
      .setPreAuthenticatedUserDetailsService(getUserDetailsService());
  authenticationProvider = postProcess(authenticationProvider);
  // @formatter:off
  http
    .authenticationProvider(authenticationProvider)
    .setSharedObject(AuthenticationEntryPoint.class, new Http403ForbiddenEntryPoint());
  // @formatter:on
}
origin: spring-projects/spring-security

  oauth2LoginAuthenticationProvider.setAuthoritiesMapper(userAuthoritiesMapper);
http.authenticationProvider(this.postProcess(oauth2LoginAuthenticationProvider));
    oidcAuthorizationCodeAuthenticationProvider.setAuthoritiesMapper(userAuthoritiesMapper);
  http.authenticationProvider(this.postProcess(oidcAuthorizationCodeAuthenticationProvider));
} else {
  http.authenticationProvider(new OidcAuthenticationRequestChecker());
origin: spring-projects/spring-security

@SuppressWarnings("unchecked")
@Override
public void init(H http) throws Exception {
  validateInput();
  String key = getKey();
  RememberMeServices rememberMeServices = getRememberMeServices(http, key);
  http.setSharedObject(RememberMeServices.class, rememberMeServices);
  LogoutConfigurer<H> logoutConfigurer = http.getConfigurer(LogoutConfigurer.class);
  if (logoutConfigurer != null && this.logoutHandler != null) {
    logoutConfigurer.addLogoutHandler(this.logoutHandler);
  }
  RememberMeAuthenticationProvider authenticationProvider = new RememberMeAuthenticationProvider(
      key);
  authenticationProvider = postProcess(authenticationProvider);
  http.authenticationProvider(authenticationProvider);
  initDefaultLoginFilter(http);
}
origin: spring-projects/spring-security

@Override
public void configure(H http) throws Exception {
  BearerTokenResolver bearerTokenResolver = getBearerTokenResolver();
  this.requestMatcher.setBearerTokenResolver(bearerTokenResolver);
  AuthenticationManager manager = http.getSharedObject(AuthenticationManager.class);
  BearerTokenAuthenticationFilter filter =
      new BearerTokenAuthenticationFilter(manager);
  filter.setBearerTokenResolver(bearerTokenResolver);
  filter.setAuthenticationEntryPoint(this.authenticationEntryPoint);
  filter = postProcess(filter);
  http.addFilter(filter);
  if ( this.jwtConfigurer == null ) {
    throw new IllegalStateException("Jwt is the only supported format for bearer tokens " +
        "in Spring Security and no Jwt configuration was found. Make sure to specify " +
        "a jwk set uri by doing http.oauth2ResourceServer().jwt().jwkSetUri(uri), or wire a " +
        "JwtDecoder instance by doing http.oauth2ResourceServer().jwt().decoder(decoder), or " +
        "expose a JwtDecoder instance as a bean and do http.oauth2ResourceServer().jwt().");
  }
  JwtDecoder decoder = this.jwtConfigurer.getJwtDecoder();
  Converter<Jwt, ? extends AbstractAuthenticationToken> jwtAuthenticationConverter =
      this.jwtConfigurer.getJwtAuthenticationConverter();
  JwtAuthenticationProvider provider =
      new JwtAuthenticationProvider(decoder);
  provider.setJwtAuthenticationConverter(jwtAuthenticationConverter);
  provider = postProcess(provider);
  http.authenticationProvider(provider);
}
origin: org.springframework.security/spring-security-config

@Override
public void init(H http) throws Exception {
  if (authenticationProvider == null) {
    authenticationProvider = new AnonymousAuthenticationProvider(getKey());
  }
  if (authenticationFilter == null) {
    authenticationFilter = new AnonymousAuthenticationFilter(getKey(), principal,
        authorities);
  }
  authenticationProvider = postProcess(authenticationProvider);
  http.authenticationProvider(authenticationProvider);
}
origin: org.springframework.security/spring-security-config

@Override
public void init(H http) throws Exception {
  PreAuthenticatedAuthenticationProvider authenticationProvider = new PreAuthenticatedAuthenticationProvider();
  authenticationProvider.setPreAuthenticatedUserDetailsService(getAuthenticationUserDetailsService(http));
  http
    .authenticationProvider(authenticationProvider)
    .setSharedObject(AuthenticationEntryPoint.class, new Http403ForbiddenEntryPoint());
}
// @formatter:on
origin: org.springframework.security/spring-security-config

@Override
public void init(H http) throws Exception {
  super.init(http);
  OpenIDAuthenticationProvider authenticationProvider = new OpenIDAuthenticationProvider();
  authenticationProvider.setAuthenticationUserDetailsService(
      getAuthenticationUserDetailsService(http));
  authenticationProvider = postProcess(authenticationProvider);
  http.authenticationProvider(authenticationProvider);
  initDefaultLoginFilter(http);
}
origin: org.springframework.security/spring-security-config

/**
 * Populates a {@link PreAuthenticatedAuthenticationProvider} into
 * {@link HttpSecurity#authenticationProvider(org.springframework.security.authentication.AuthenticationProvider)}
 * and a {@link Http403ForbiddenEntryPoint} into
 * {@link HttpSecurityBuilder#setSharedObject(Class, Object)}
 *
 * @see org.springframework.security.config.annotation.SecurityConfigurerAdapter#init(org.springframework.security.config.annotation.SecurityBuilder)
 */
@Override
public void init(H http) throws Exception {
  PreAuthenticatedAuthenticationProvider authenticationProvider = new PreAuthenticatedAuthenticationProvider();
  authenticationProvider
      .setPreAuthenticatedUserDetailsService(getUserDetailsService());
  authenticationProvider = postProcess(authenticationProvider);
  // @formatter:off
  http
    .authenticationProvider(authenticationProvider)
    .setSharedObject(AuthenticationEntryPoint.class, new Http403ForbiddenEntryPoint());
  // @formatter:on
}
origin: org.springframework.security/spring-security-config

  oauth2LoginAuthenticationProvider.setAuthoritiesMapper(userAuthoritiesMapper);
http.authenticationProvider(this.postProcess(oauth2LoginAuthenticationProvider));
    oidcAuthorizationCodeAuthenticationProvider.setAuthoritiesMapper(userAuthoritiesMapper);
  http.authenticationProvider(this.postProcess(oidcAuthorizationCodeAuthenticationProvider));
} else {
  http.authenticationProvider(new OidcAuthenticationRequestChecker());
origin: org.springframework.security/spring-security-config

@SuppressWarnings("unchecked")
@Override
public void init(H http) throws Exception {
  validateInput();
  String key = getKey();
  RememberMeServices rememberMeServices = getRememberMeServices(http, key);
  http.setSharedObject(RememberMeServices.class, rememberMeServices);
  LogoutConfigurer<H> logoutConfigurer = http.getConfigurer(LogoutConfigurer.class);
  if (logoutConfigurer != null && this.logoutHandler != null) {
    logoutConfigurer.addLogoutHandler(this.logoutHandler);
  }
  RememberMeAuthenticationProvider authenticationProvider = new RememberMeAuthenticationProvider(
      key);
  authenticationProvider = postProcess(authenticationProvider);
  http.authenticationProvider(authenticationProvider);
  initDefaultLoginFilter(http);
}
origin: org.springframework.security/spring-security-config

@Override
public void configure(H http) throws Exception {
  BearerTokenResolver bearerTokenResolver = getBearerTokenResolver();
  this.requestMatcher.setBearerTokenResolver(bearerTokenResolver);
  AuthenticationManager manager = http.getSharedObject(AuthenticationManager.class);
  BearerTokenAuthenticationFilter filter =
      new BearerTokenAuthenticationFilter(manager);
  filter.setBearerTokenResolver(bearerTokenResolver);
  filter.setAuthenticationEntryPoint(this.authenticationEntryPoint);
  filter = postProcess(filter);
  http.addFilter(filter);
  if ( this.jwtConfigurer == null ) {
    throw new IllegalStateException("Jwt is the only supported format for bearer tokens " +
        "in Spring Security and no Jwt configuration was found. Make sure to specify " +
        "a jwk set uri by doing http.oauth2ResourceServer().jwt().jwkSetUri(uri), or wire a " +
        "JwtDecoder instance by doing http.oauth2ResourceServer().jwt().decoder(decoder), or " +
        "expose a JwtDecoder instance as a bean and do http.oauth2ResourceServer().jwt().");
  }
  JwtDecoder decoder = this.jwtConfigurer.getJwtDecoder();
  Converter<Jwt, ? extends AbstractAuthenticationToken> jwtAuthenticationConverter =
      this.jwtConfigurer.getJwtAuthenticationConverter();
  JwtAuthenticationProvider provider =
      new JwtAuthenticationProvider(decoder);
  provider.setJwtAuthenticationConverter(jwtAuthenticationConverter);
  provider = postProcess(provider);
  http.authenticationProvider(provider);
}
origin: apache/servicemix-bundles

@Override
public void init(H http) throws Exception {
  PreAuthenticatedAuthenticationProvider authenticationProvider = new PreAuthenticatedAuthenticationProvider();
  authenticationProvider.setPreAuthenticatedUserDetailsService(getAuthenticationUserDetailsService(http));
  http
    .authenticationProvider(authenticationProvider)
    .setSharedObject(AuthenticationEntryPoint.class, new Http403ForbiddenEntryPoint());
}
// @formatter:on
origin: org.springframework.security/spring-security-javaconfig

@Override
public void init(H http) throws Exception {
  PreAuthenticatedAuthenticationProvider authenticationProvider = new PreAuthenticatedAuthenticationProvider();
  authenticationProvider.setPreAuthenticatedUserDetailsService(getAuthenticationUserDetailsService(http));
  http
    .authenticationProvider(authenticationProvider)
    .setSharedObject(AuthenticationEntryPoint.class,new Http403ForbiddenEntryPoint());
}
origin: org.springframework.security/spring-security-javaconfig

@Override
public void init(H http) throws Exception {
  if(authenticationProvider == null) {
    authenticationProvider = new AnonymousAuthenticationProvider(getKey());
  }
  if(authenticationFilter == null) {
    authenticationFilter = new AnonymousAuthenticationFilter(getKey(), principal, authorities);
  }
  authenticationProvider = postProcess(authenticationProvider);
  http.authenticationProvider(authenticationProvider);
}
origin: apache/servicemix-bundles

@Override
public void init(H http) throws Exception {
  if (authenticationProvider == null) {
    authenticationProvider = new AnonymousAuthenticationProvider(getKey());
  }
  if (authenticationFilter == null) {
    authenticationFilter = new AnonymousAuthenticationFilter(getKey(), principal,
        authorities);
  }
  authenticationProvider = postProcess(authenticationProvider);
  http.authenticationProvider(authenticationProvider);
}
origin: org.springframework.security/spring-security-javaconfig

@Override
public void init(H http) throws Exception {
  super.init(http);
  OpenIDAuthenticationProvider authenticationProvider = new OpenIDAuthenticationProvider();
  authenticationProvider.setAuthenticationUserDetailsService(getAuthenticationUserDetailsService(http));
  authenticationProvider = postProcess(authenticationProvider);
  http.authenticationProvider(authenticationProvider);
  initDefaultLoginFilter(http);
}
origin: apache/servicemix-bundles

@Override
public void init(H http) throws Exception {
  super.init(http);
  OpenIDAuthenticationProvider authenticationProvider = new OpenIDAuthenticationProvider();
  authenticationProvider.setAuthenticationUserDetailsService(
      getAuthenticationUserDetailsService(http));
  authenticationProvider = postProcess(authenticationProvider);
  http.authenticationProvider(authenticationProvider);
  initDefaultLoginFilter(http);
}
org.springframework.security.config.annotation.webHttpSecurityBuilderauthenticationProvider

Javadoc

Allows adding an additional AuthenticationProvider to be used

Popular methods of HttpSecurityBuilder

  • getSharedObject
    Gets a shared Object. Note that object heirarchies are not considered.
  • addFilter
    Adds a Filter that must be an instance of or extend one of the Filters provided within the Security
  • getConfigurer
    Gets the SecurityConfigurer by its class name ornull if not found. Note that object hierarchies are
  • removeConfigurer
    Removes the SecurityConfigurer by its class name ornull if not found. Note that object hierarchies a
  • setSharedObject
    Sets an object that is shared by multiple SecurityConfigurer.
  • addFilterBefore
    Allows adding a Filter before one of the known Filterclasses. The known Filter instances are either
  • getAuthenticationManager

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getSupportFragmentManager (FragmentActivity)
  • getSystemService (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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