本文整理汇总了Java中org.springframework.security.web.authentication.AuthenticationSuccessHandler类的典型用法代码示例。如果您正苦于以下问题:Java AuthenticationSuccessHandler类的具体用法?Java AuthenticationSuccessHandler怎么用?Java AuthenticationSuccessHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AuthenticationSuccessHandler类属于org.springframework.security.web.authentication包,在下文中一共展示了AuthenticationSuccessHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Can_wrap_a_success_handler
import org.springframework.security.web.authentication.AuthenticationSuccessHandler; //导入依赖的package包/类
@Test
public void Can_wrap_a_success_handler() {
final UsernamePasswordAuthenticationFilter filter = mock(UsernamePasswordAuthenticationFilter.class);
final AuthenticationSuccessHandler oldSuccessHandler = mock(AuthenticationSuccessHandler.class);
final JwtAuthenticationSuccessHandler newSuccessHandler = mock(JwtAuthenticationSuccessHandler.class);
// Given
given(mutator.retrieve(filter, "successHandler", AuthenticationSuccessHandler.class))
.willReturn(oldSuccessHandler);
given(successHandler.withDelegate(oldSuccessHandler)).willReturn(newSuccessHandler);
// When
successHandlerWrapper.modify(filter);
// Then
verify(filter).setAuthenticationSuccessHandler(newSuccessHandler);
}
开发者ID:shiver-me-timbers,项目名称:smt-spring-security-parent,代码行数:20,代码来源:JwtSuccessHandlerWrapperTest.java
示例2: Can_update_the_delegate
import org.springframework.security.web.authentication.AuthenticationSuccessHandler; //导入依赖的package包/类
@Test
public void Can_update_the_delegate() throws IOException, ServletException {
final HttpServletRequest request = mock(HttpServletRequest.class);
final HttpServletResponse response = mock(HttpServletResponse.class);
final Authentication authentication = mock(Authentication.class);
final AuthenticationSuccessHandler delegate = mock(AuthenticationSuccessHandler.class);
// Given
successHandler.withDelegate(delegate);
// When
successHandler.onAuthenticationSuccess(request, response, authentication);
// Then
final InOrder order = inOrder(authenticationApplier, delegate);
order.verify(authenticationApplier).apply(authentication, response);
order.verify(delegate).onAuthenticationSuccess(request, response, authentication);
}
开发者ID:shiver-me-timbers,项目名称:smt-spring-security-parent,代码行数:21,代码来源:CookieAndHeaderJwtAuthenticationSuccessHandlerTest.java
示例3: Can_set_a_wrapped_authentication_success_handler
import org.springframework.security.web.authentication.AuthenticationSuccessHandler; //导入依赖的package包/类
@Test
public void Can_set_a_wrapped_authentication_success_handler() throws IllegalAccessException {
final AuthenticationSuccessHandler newSuccessHandler = mock(AuthenticationSuccessHandler.class);
final JwtAuthenticationSuccessHandler withSuccessHandler = mock(JwtAuthenticationSuccessHandler.class);
// Given
final Object successHandler = extractFiledValue(filter, "successHandler");
given(jwtSuccessHandler.withDelegate((AuthenticationSuccessHandler) successHandler))
.willReturn(withSuccessHandler);
// When
final WrappedUsernamePasswordAuthenticationFilter wrappedFilter
= new WrappedUsernamePasswordAuthenticationFilter(reflectionFieldMutator, filter, jwtSuccessHandler);
wrappedFilter.setAuthenticationSuccessHandler(newSuccessHandler);
// Then
verify(jwtSuccessHandler).withDelegate(newSuccessHandler);
assertThat(wrappedFilter.getSuccessHandler(), is((AuthenticationSuccessHandler) withSuccessHandler));
}
开发者ID:shiver-me-timbers,项目名称:smt-spring-security-parent,代码行数:22,代码来源:WrappedUsernamePasswordAuthenticationFilterTest.java
示例4: customize
import org.springframework.security.web.authentication.AuthenticationSuccessHandler; //导入依赖的package包/类
@SuppressWarnings("ProhibitedExceptionDeclared")
@Override
public void customize(final HttpSecurity http, final AuthenticationManager authenticationManager) throws Exception {
final AuthenticationSuccessHandler successHandler = new IdolLoginSuccessHandler(
FindController.CONFIG_PATH,
FindController.APP_PATH,
FindRole.CONFIG.toString(),
authenticationInformationRetriever
);
http.formLogin()
.loginPage(FindController.DEFAULT_LOGIN_PAGE)
.loginProcessingUrl("/authenticate")
.successHandler(successHandler)
.failureUrl(FindController.DEFAULT_LOGIN_PAGE + "?error=auth");
}
示例5: successHandler
import org.springframework.security.web.authentication.AuthenticationSuccessHandler; //导入依赖的package包/类
protected AuthenticationSuccessHandler successHandler() {
return new AuthenticationSuccessHandler() {
@Override
public void onAuthenticationSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) throws IOException, ServletException {
httpServletResponse.getWriter().append("OK");
httpServletResponse.setStatus(200);
}
};
}
示例6: AjaxLoginProcessingFilter
import org.springframework.security.web.authentication.AuthenticationSuccessHandler; //导入依赖的package包/类
public AjaxLoginProcessingFilter(String defaultProcessUrl, AuthenticationSuccessHandler successHandler,
AuthenticationFailureHandler failureHandler, ObjectMapper mapper) {
super(defaultProcessUrl);
this.successHandler = successHandler;
this.failureHandler = failureHandler;
this.objectMapper = mapper;
}
示例7: AdminUserProcessingFilter
import org.springframework.security.web.authentication.AuthenticationSuccessHandler; //导入依赖的package包/类
public AdminUserProcessingFilter(String defaultProcessUrl, AuthenticationSuccessHandler successHandler,
AuthenticationFailureHandler failureHandler, ObjectMapper mapper) {
super(defaultProcessUrl);
this.successHandler = successHandler;
this.failureHandler = failureHandler;
this.objectMapper = mapper;
}
示例8: ProfChoperSecurityConfig
import org.springframework.security.web.authentication.AuthenticationSuccessHandler; //导入依赖的package包/类
@Autowired
public ProfChoperSecurityConfig(@Qualifier("profChoperDataSource") DataSource dataSource,
AccessDeniedHandler accessDeniedHandler,
AuthenticationSuccessHandler successHandler) {
this.dataSource = dataSource;
this.accessDeniedHandler = accessDeniedHandler;
this.successHandler = successHandler;
}
示例9: RefreshTokenProcessingFilter
import org.springframework.security.web.authentication.AuthenticationSuccessHandler; //导入依赖的package包/类
public RefreshTokenProcessingFilter(String defaultProcessUrl, AuthenticationSuccessHandler successHandler,
AuthenticationFailureHandler failureHandler, ObjectMapper mapper) {
super(defaultProcessUrl);
this.successHandler = successHandler;
this.failureHandler = failureHandler;
this.objectMapper = mapper;
}
示例10: RestPublicLoginProcessingFilter
import org.springframework.security.web.authentication.AuthenticationSuccessHandler; //导入依赖的package包/类
public RestPublicLoginProcessingFilter(String defaultProcessUrl, AuthenticationSuccessHandler successHandler,
AuthenticationFailureHandler failureHandler, ObjectMapper mapper) {
super(defaultProcessUrl);
this.successHandler = successHandler;
this.failureHandler = failureHandler;
this.objectMapper = mapper;
}
示例11: RestLoginProcessingFilter
import org.springframework.security.web.authentication.AuthenticationSuccessHandler; //导入依赖的package包/类
public RestLoginProcessingFilter(String defaultProcessUrl, AuthenticationSuccessHandler successHandler,
AuthenticationFailureHandler failureHandler, ObjectMapper mapper) {
super(defaultProcessUrl);
this.successHandler = successHandler;
this.failureHandler = failureHandler;
this.objectMapper = mapper;
}
示例12: OneTimePasswordFilterConfigurer
import org.springframework.security.web.authentication.AuthenticationSuccessHandler; //导入依赖的package包/类
public OneTimePasswordFilterConfigurer(final String loginProcessingUrl,
AuthenticationSuccessHandler successHandler,
AuthenticationFailureHandler failureHandler,
AuthenticationEntryPoint entryPoint) {
this.authFilter = new OneTimePasswordAuthenticationFilter(loginProcessingUrl);
this.authFilter.setRequiresAuthenticationRequestMatcher(new AntPathRequestMatcher(loginProcessingUrl, "POST"));
this.authFilter.setAuthenticationSuccessHandler(successHandler);
this.authFilter.setAuthenticationFailureHandler(failureHandler);
this.authFilter.setAllowSessionCreation(true);
this.authenticationEntryPoint = entryPoint;
}
示例13: modify
import org.springframework.security.web.authentication.AuthenticationSuccessHandler; //导入依赖的package包/类
@Override
public void modify(final UsernamePasswordAuthenticationFilter filter) {
filter.setAuthenticationSuccessHandler(
successHandler.withDelegate(
mutator.retrieve(filter, "successHandler", AuthenticationSuccessHandler.class)
)
);
}
示例14: CookieAndHeaderJwtAuthenticationSuccessHandler
import org.springframework.security.web.authentication.AuthenticationSuccessHandler; //导入依赖的package包/类
public CookieAndHeaderJwtAuthenticationSuccessHandler(
JwtAuthenticationApplier authenticationApplier,
AuthenticationSuccessHandler delegate
) {
this.authenticationApplier = authenticationApplier;
this.delegate = delegate;
}
开发者ID:shiver-me-timbers,项目名称:smt-spring-security-parent,代码行数:8,代码来源:CookieAndHeaderJwtAuthenticationSuccessHandler.java
示例15: setUp
import org.springframework.security.web.authentication.AuthenticationSuccessHandler; //导入依赖的package包/类
@Before
@SuppressWarnings("unchecked")
public void setUp() {
delegate = mock(AuthenticationSuccessHandler.class);
authenticationApplier = mock(JwtAuthenticationApplier.class);
successHandler = new CookieAndHeaderJwtAuthenticationSuccessHandler(authenticationApplier, delegate);
}
开发者ID:shiver-me-timbers,项目名称:smt-spring-security-parent,代码行数:8,代码来源:CookieAndHeaderJwtAuthenticationSuccessHandlerTest.java