本文整理匯總了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