当前位置: 首页>>代码示例>>Java>>正文


Java AuthenticationSuccessHandler类代码示例

本文整理汇总了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");
}
 
开发者ID:hpe-idol,项目名称:find,代码行数:17,代码来源:IdolSecurityCustomizerImpl.java

示例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);
	 }
 };
}
 
开发者ID:vishal1997,项目名称:DiscussionPortal,代码行数:10,代码来源:AuthenticationHandler.java

示例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;
}
 
开发者ID:Apereo-Learning-Analytics-Initiative,项目名称:OpenLRW,代码行数:8,代码来源:AjaxLoginProcessingFilter.java

示例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;
}
 
开发者ID:Apereo-Learning-Analytics-Initiative,项目名称:OpenLRW,代码行数:8,代码来源:AdminUserProcessingFilter.java

示例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;
}
 
开发者ID:ericywl,项目名称:InfoSys-1D,代码行数:10,代码来源:ProfChoperSecurityConfig.java

示例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;
}
 
开发者ID:osswangxining,项目名称:iotplatform,代码行数:8,代码来源:RefreshTokenProcessingFilter.java

示例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;
}
 
开发者ID:osswangxining,项目名称:iotplatform,代码行数:8,代码来源:RestPublicLoginProcessingFilter.java

示例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;
}
 
开发者ID:osswangxining,项目名称:iotplatform,代码行数:8,代码来源:RestLoginProcessingFilter.java

示例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;
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:12,代码来源:OneTimePasswordFilterConfigurer.java

示例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)
        )
    );
}
 
开发者ID:shiver-me-timbers,项目名称:smt-spring-security-parent,代码行数:9,代码来源:JwtSuccessHandlerWrapper.java

示例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


注:本文中的org.springframework.security.web.authentication.AuthenticationSuccessHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。