@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); }
@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
@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); }
/** * 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 }
oauth2LoginAuthenticationProvider.setAuthoritiesMapper(userAuthoritiesMapper); http.authenticationProvider(this.postProcess(oauth2LoginAuthenticationProvider)); oidcAuthorizationCodeAuthenticationProvider.setAuthoritiesMapper(userAuthoritiesMapper); http.authenticationProvider(this.postProcess(oidcAuthorizationCodeAuthenticationProvider)); } else { http.authenticationProvider(new OidcAuthenticationRequestChecker());
@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); }
@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); }
@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); }
@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
@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); }
/** * 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 }
oauth2LoginAuthenticationProvider.setAuthoritiesMapper(userAuthoritiesMapper); http.authenticationProvider(this.postProcess(oauth2LoginAuthenticationProvider)); oidcAuthorizationCodeAuthenticationProvider.setAuthoritiesMapper(userAuthoritiesMapper); http.authenticationProvider(this.postProcess(oidcAuthorizationCodeAuthenticationProvider)); } else { http.authenticationProvider(new OidcAuthenticationRequestChecker());
@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); }
@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); }
@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
@Override public void init(H http) throws Exception { PreAuthenticatedAuthenticationProvider authenticationProvider = new PreAuthenticatedAuthenticationProvider(); authenticationProvider.setPreAuthenticatedUserDetailsService(getAuthenticationUserDetailsService(http)); http .authenticationProvider(authenticationProvider) .setSharedObject(AuthenticationEntryPoint.class,new Http403ForbiddenEntryPoint()); }
@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); }
@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); }
@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); }
@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); }