本文整理匯總了Java中org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler類的典型用法代碼示例。如果您正苦於以下問題:Java SimpleUrlAuthenticationFailureHandler類的具體用法?Java SimpleUrlAuthenticationFailureHandler怎麽用?Java SimpleUrlAuthenticationFailureHandler使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
SimpleUrlAuthenticationFailureHandler類屬於org.springframework.security.web.authentication包,在下文中一共展示了SimpleUrlAuthenticationFailureHandler類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: requestHeaderAuthenticationFilter
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; //導入依賴的package包/類
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
private RequestHeaderAuthenticationFilter requestHeaderAuthenticationFilter() throws Exception {
RequestHeaderAuthenticationFilter f = new RequestHeaderAuthenticationFilter();
f.setPrincipalRequestHeader("X-Forwarded-User");
f.setCredentialsRequestHeader("X-Forwarded-Access-Token");
f.setAuthenticationManager(authenticationManager());
f.setAuthenticationDetailsSource(
(AuthenticationDetailsSource<HttpServletRequest, PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetails>)
(request) ->new PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetails(
request,
AuthorityUtils.createAuthorityList("ROLE_AUTHENTICATED")
)
);
f.setAuthenticationFailureHandler(new SimpleUrlAuthenticationFailureHandler());
f.setExceptionIfHeaderMissing(false);
return f;
}
示例2: domainUsernamePasswordAuthenticationFilter
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; //導入依賴的package包/類
/**
*
* @return
* @throws Exception
*/
@Bean
public DomainUsernamePasswordAuthenticationFilter domainUsernamePasswordAuthenticationFilter()
throws Exception {
DomainUsernamePasswordAuthenticationFilter dupaf = new DomainUsernamePasswordAuthenticationFilter(
super.authenticationManagerBean());
dupaf.setFilterProcessesUrl("/login");
dupaf.setUsernameParameter("username");
dupaf.setPasswordParameter("password");
dupaf.setAuthenticationSuccessHandler(
new SavedRequestAwareAuthenticationSuccessHandler(){{
setDefaultTargetUrl("/default");
}}
);
dupaf.setAuthenticationFailureHandler(
new SimpleUrlAuthenticationFailureHandler(){{
setDefaultFailureUrl("/login/form?error");
}}
);
dupaf.afterPropertiesSet();
return dupaf;
}
示例3: GoogleAuthenticationProcessingFilter
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; //導入依賴的package包/類
public GoogleAuthenticationProcessingFilter(GooglePublicKeysManager googlePublicKeysManager,
DataService dataService, UserDetailsService userDetailsService,
AuthenticationSettings authenticationSettings, UserFactory userFactory,
GroupMemberFactory groupMemberFactory)
{
super(new AntPathRequestMatcher(GOOGLE_AUTHENTICATION_URL, POST.toString()));
this.userFactory = requireNonNull(userFactory);
this.groupMemberFactory = requireNonNull(groupMemberFactory);
setAuthenticationFailureHandler(new SimpleUrlAuthenticationFailureHandler("/login?error"));
this.googlePublicKeysManager = requireNonNull(googlePublicKeysManager);
this.dataService = requireNonNull(dataService);
this.userDetailsService = requireNonNull(userDetailsService);
this.authenticationSettings = requireNonNull(authenticationSettings);
}
示例4: init
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; //導入依賴的package包/類
public void init() {
System.err.println(" ---------------AuthenticationFilter init--------------- ");
this.setUsernameParameter(USERNAME);
this.setPasswordParameter(PASSWORD);
// 驗證成功,跳轉的頁麵
SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
successHandler.setDefaultTargetUrl(successUrl);
this.setAuthenticationSuccessHandler(successHandler);
// 驗證失敗,跳轉的頁麵
SimpleUrlAuthenticationFailureHandler failureHandler = new SimpleUrlAuthenticationFailureHandler();
failureHandler.setDefaultFailureUrl(errorUrl);
this.setAuthenticationFailureHandler(failureHandler);
}
示例5: getSimpleRestAuthenticationFilter
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; //導入依賴的package包/類
/**
* Create a simple authentication filter for REST logins that reads user-credentials from a json-parameter and returns
* status 200 instead of redirect after login.
*
* @return the {@link JsonUsernamePasswordAuthenticationFilter}.
* @throws Exception if something goes wrong.
*/
protected JsonUsernamePasswordAuthenticationFilter getSimpleRestAuthenticationFilter() throws Exception {
JsonUsernamePasswordAuthenticationFilter jsonFilter =
new JsonUsernamePasswordAuthenticationFilter(new AntPathRequestMatcher("/services/rest/login"));
jsonFilter.setPasswordParameter("j_password");
jsonFilter.setUsernameParameter("j_username");
jsonFilter.setAuthenticationManager(authenticationManager());
// set failurehandler that uses no redirect in case of login failure; just HTTP-status: 401
jsonFilter.setAuthenticationManager(authenticationManagerBean());
jsonFilter.setAuthenticationFailureHandler(new SimpleUrlAuthenticationFailureHandler());
// set successhandler that uses no redirect in case of login success; just HTTP-status: 200
jsonFilter.setAuthenticationSuccessHandler(new AuthenticationSuccessHandlerSendingOkHttpStatusCode());
return jsonFilter;
}
示例6: configure
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; //導入依賴的package包/類
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.csrf()
.disable();
http
.addFilterBefore(metadataGeneratorFilter(), ChannelProcessingFilter.class)
.addFilterAfter(samlFilter(), BasicAuthenticationFilter.class);
http
.authorizeRequests()
.antMatchers("/").permitAll()
.antMatchers("/error").permitAll()
.antMatchers("/saml/**").permitAll()
.antMatchers("/css/**").permitAll()
.anyRequest().authenticated();
http
.exceptionHandling().accessDeniedHandler(new AccessDeniedHandlerImpl())
.authenticationEntryPoint(getAuthEntryPoint())
.and()
.formLogin()
.loginProcessingUrl("/authenticate")
.usernameParameter("username")
.passwordParameter("password")
.successHandler(new FormAuthSuccessHandler())
.failureHandler(new SimpleUrlAuthenticationFailureHandler())
.and()
.logout()
.logoutUrl("/logout")
.logoutSuccessUrl("/")
.permitAll();
}
示例7: authenticationFailureHandler
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; //導入依賴的package包/類
@Bean
public SimpleUrlAuthenticationFailureHandler authenticationFailureHandler() {
SimpleUrlAuthenticationFailureHandler failureHandler =
new SimpleUrlAuthenticationFailureHandler();
failureHandler.setUseForward(true);
failureHandler.setDefaultFailureUrl("/login");
return failureHandler;
}
示例8: failureRedirectHandler
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; //導入依賴的package包/類
@Bean
public SimpleUrlAuthenticationFailureHandler failureRedirectHandler() {
SimpleUrlAuthenticationFailureHandler failureHandler = new SimpleUrlAuthenticationFailureHandler();
// The precondition on `setDefaultFailureUrl(..)` will cause an exception if the value is null.
// So, only set this value if it is not null
if (!samlConfigBean().getFailedLoginDefaultUrl().isEmpty()) {
failureHandler.setDefaultFailureUrl(samlConfigBean().getFailedLoginDefaultUrl());
}
return failureHandler;
}
開發者ID:choonchernlim,項目名稱:spring-security-adfs-saml2,代碼行數:13,代碼來源:SAMLWebSecurityConfigurerAdapter.java
示例9: failureHandler
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; //導入依賴的package包/類
/**
* Failed login handler, returning a 401 code instead of a login page
*
* @return
*/
@Bean
public AuthenticationFailureHandler failureHandler() {
return new SimpleUrlAuthenticationFailureHandler() {
@Override
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException {
LOG.warn("LOGIN >>> authentication failure");
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, exception.getMessage());
}
};
}
示例10: authenticationFailureHandler
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; //導入依賴的package包/類
@Bean
public SimpleUrlAuthenticationFailureHandler authenticationFailureHandler() {
SimpleUrlAuthenticationFailureHandler failureHandler =
new SimpleUrlAuthenticationFailureHandler();
failureHandler.setUseForward(true);
failureHandler.setDefaultFailureUrl("/error");
return failureHandler;
}
示例11: authenticationFailureHandler
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; //導入依賴的package包/類
@Bean
public SimpleUrlAuthenticationFailureHandler authenticationFailureHandler() {
SimpleUrlAuthenticationFailureHandler handler = new SimpleUrlAuthenticationFailureHandler();
handler.setUseForward(false);
//handler.setDefaultFailureUrl("/error");
return handler;
}
示例12: configure
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; //導入依賴的package包/類
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.csrf().disable()
.exceptionHandling()
.authenticationEntryPoint(entryPoint)
.and().authorizeRequests()
.antMatchers("/api/1/**").authenticated()
.and().formLogin()
.successHandler(successHandler)
.failureHandler(new SimpleUrlAuthenticationFailureHandler())
.and().logout();
}
示例13: setUp
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; //導入依賴的package包/類
@Before
public void setUp() {
SuperflySelectRoleAuthenticationProcessingFilter procFilter = new SuperflySelectRoleAuthenticationProcessingFilter();
procFilter.setAuthenticationManager(authenticationManager);
procFilter.setAuthenticationFailureHandler(new SimpleUrlAuthenticationFailureHandler("/login-failed"));
procFilter.afterPropertiesSet();
filter = procFilter;
}
開發者ID:payneteasy,項目名稱:superfly,代碼行數:9,代碼來源:SuperflySelectRoleAuthenticationProcessingFilterTest.java
示例14: setUp
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; //導入依賴的package包/類
@Before
public void setUp() {
SuperflyUsernamePasswordAuthenticationProcessingFilter procFilter = new SuperflyUsernamePasswordAuthenticationProcessingFilter();
procFilter.setAuthenticationManager(authenticationManager);
procFilter.setAuthenticationFailureHandler(new SimpleUrlAuthenticationFailureHandler("/login-failed"));
procFilter.setSubsystemIdentifier("my-subsystem");
procFilter.afterPropertiesSet();
filter = procFilter;
}
開發者ID:payneteasy,項目名稱:superfly,代碼行數:10,代碼來源:SuperflyUsernamePasswordAuthenticationProcessingFilterTest.java
示例15: setUp
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; //導入依賴的package包/類
@Before
public void setUp() {
SuperflySSOAuthenticationProcessingFilter procFilter = new SuperflySSOAuthenticationProcessingFilter();
procFilter.setAuthenticationManager(authenticationManager);
procFilter.setAuthenticationFailureHandler(new SimpleUrlAuthenticationFailureHandler("/login-failed"));
procFilter.afterPropertiesSet();
filter = procFilter;
}