當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。