本文整理匯總了Java中org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter類的典型用法代碼示例。如果您正苦於以下問題:Java AbstractAuthenticationProcessingFilter類的具體用法?Java AbstractAuthenticationProcessingFilter怎麽用?Java AbstractAuthenticationProcessingFilter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
AbstractAuthenticationProcessingFilter類屬於org.springframework.security.web.authentication包,在下文中一共展示了AbstractAuthenticationProcessingFilter類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: init
import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter; //導入依賴的package包/類
@Override
public void init(HttpSecurity http) throws Exception {
autowireThis(http);
http.logout().addLogoutHandler(logoutHandler);
fieldMutator.update(
http.formLogin(),
"authFilter",
AbstractAuthenticationProcessingFilter.class,
new UsernamePasswordAuthenticationFilterWrapper()
);
http.addFilterBefore(authenticationFilter, UsernamePasswordAuthenticationFilter.class);
}
示例2: createCustomFilter
import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter; //導入依賴的package包/類
protected AbstractAuthenticationProcessingFilter createCustomFilter() throws Exception {
//here we define the interfaces which don't need any authorisation
AuthFilter filter = new AuthFilter(new NegatedRequestMatcher(
new AndRequestMatcher(
new AntPathRequestMatcher("/login"),
new AntPathRequestMatcher("/health")
)
));
filter.setAuthenticationManager(authenticationManagerBean());
return filter;
}
示例3: addRecaptchaSupport
import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter; //導入依賴的package包/類
public FormLoginConfigurer<HttpSecurity> addRecaptchaSupport(FormLoginConfigurer<HttpSecurity> loginConfigurer) {
Field authFilterField = findField(loginConfigurer.getClass(), AUTHENTICATION_PROCESSING_FILTER_FIELD, AbstractAuthenticationProcessingFilter.class);
makeAccessible(authFilterField);
setField(authFilterField, loginConfigurer, authenticationFilter);
return loginConfigurer.usernameParameter(DEFAULT_USERNAME_PARAMETER)
.successHandler(successHandler)
.failureHandler(failureHandler);
}
示例4: onActivate
import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter; //導入依賴的package包/類
@Log
void onActivate(String loginError) {
if ("error".equals(loginError)) {
this.errorMessage = ((Exception) request
.getSession(true)
.getAttribute(AbstractAuthenticationProcessingFilter.SPRING_SECURITY_LAST_EXCEPTION_KEY))
.getMessage();
logger.error(String.format("Error while attempting to login: %s",
errorMessage));
}
}
示例5: filterUsesConfiguredFailureHandler
import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter; //導入依賴的package包/類
@Test
public void filterUsesConfiguredFailureHandler() throws Exception {
final Field failureHandlerField = AbstractAuthenticationProcessingFilter.class.getDeclaredField("failureHandler");
ReflectionUtils.makeAccessible(failureHandlerField);
AuthenticationFailureHandler failureHandler = (AuthenticationFailureHandler) ReflectionUtils.getField(failureHandlerField, filter);
assertTrue("failure handler should be a simpleUrlFailureHandler", failureHandler instanceof SimpleUrlAuthenticationFailureHandler);
final Field failureUrlField = SimpleUrlAuthenticationFailureHandler.class.getDeclaredField("defaultFailureUrl");
ReflectionUtils.makeAccessible(failureUrlField);
String failureUrl = (String) ReflectionUtils.getField(failureUrlField, failureHandler);
assertEquals("failure URL should be the configured url", "/oauth/confirm_access", failureUrl);
}
開發者ID:jungyang,項目名稱:oauth-client-master,代碼行數:13,代碼來源:AuthorizationServerBeanDefinitionParserTests.java
示例6: authenticationFilter
import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter; //導入依賴的package包/類
protected Filter authenticationFilter() {
AbstractAuthenticationProcessingFilter filter =
new SecurityContextAuthenticationFilter(SIGNIN_SUCCESS_PATH);
SavedRequestAwareAuthenticationSuccessHandler successHandler =
new SavedRequestAwareAuthenticationSuccessHandler();
successHandler.setDefaultTargetUrl("/admin");
filter.setAuthenticationSuccessHandler(successHandler);
return filter;
}
示例7: update
import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter; //導入依賴的package包/類
@Override
public AbstractAuthenticationProcessingFilter update(AbstractAuthenticationProcessingFilter filter) {
return new WrappedUsernamePasswordAuthenticationFilter(
fieldMutator, (UsernamePasswordAuthenticationFilter) filter, authenticationSuccessHandler
);
}
示例8: hackFormLoginAuthFilter
import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter; //導入依賴的package包/類
public static FormLoginConfigurer<HttpSecurity> hackFormLoginAuthFilter(FormLoginConfigurer<HttpSecurity> formLoginConfig, AbstractAuthenticationProcessingFilter filter){
ReflectUtils.getIntro(FormLoginConfigurer.class).setFieldValue(formLoginConfig, "authFilter", filter);
return formLoginConfig;
}
示例9: createOAuth2Filter
import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter; //導入依賴的package包/類
private AbstractAuthenticationProcessingFilter createOAuth2Filter(ClientResourceDetails clientDetails, AuthenticationSuccessHandler successHandler, String path) {
CustomOAuthAuthenticationProcessingFilter oauthFilter = new CustomOAuthAuthenticationProcessingFilter(path, clientDetails, jsonMessageConverter);
oauthFilter.setAuthenticationSuccessHandler(successHandler);
return oauthFilter;
}