/** * Forward Authentication Success Handler * * @param forwardUrl the target URL in case of success * @return the {@link FormLoginConfigurer} for additional customization */ public FormLoginConfigurer<H> successForwardUrl(String forwardUrl) { successHandler(new ForwardAuthenticationSuccessHandler(forwardUrl)); return this; }
@Override protected void configure(HttpSecurity http) throws Exception { // @formatter:off SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler(); successHandler.setTargetUrlParameter( "redirectTo" ); http.authorizeRequests() .antMatchers( adminContextPath + "/assets/**" ).permitAll() .antMatchers( adminContextPath + "/login" ).permitAll() .anyRequest().authenticated() .and() .formLogin().loginPage( adminContextPath + "/login" ).successHandler( successHandler ).and() .logout().logoutUrl( adminContextPath + "/logout" ).and() .httpBasic().and() .csrf().disable(); // @formatter:on } }
.formLogin() .loginPage("/sso/login") .successHandler(new GoAuthenticationSuccessHandler()) .failureHandler(new GoAuthenticationFailureHandler()) .and()
/** * Forward Authentication Success Handler * * @param forwardUrl the target URL in case of success * @return the {@link FormLoginConfigurer} for additional customization */ public FormLoginConfigurer<H> successForwardUrl(String forwardUrl) { successHandler(new ForwardAuthenticationSuccessHandler(forwardUrl)); return this; }
.permitAll() .successHandler(successHandler)
@Override public void configure(HttpSecurity http) throws Exception { http.formLogin() .successHandler(appLoginInSuccessHandler)//登录成功处理器 .and() .authorizeRequests().anyRequest().authenticated().and() .csrf().disable(); }
@Override public void configure(HttpSecurity http) throws Exception { http.formLogin() .successHandler(appLoginInSuccessHandler)//登录成功处理器 //.loginPage("/login").loginProcessingUrl("/login.do").defaultSuccessUrl("/user/info") 自定义登录授权页面 .and() .authorizeRequests().anyRequest().authenticated().and() .csrf().disable(); }
/** * Forward Authentication Success Handler * * @param forwardUrl the target URL in case of success * @return the {@link FormLoginConfigurer} for additional customization */ public FormLoginConfigurer<H> successForwardUrl(String forwardUrl) { successHandler(new ForwardAuthenticationSuccessHandler(forwardUrl)); return this; }
@Override protected void configure(HttpSecurity http) throws Exception { http .formLogin().loginPage("/login").successHandler(successHandler()).permitAll() .and() .requestMatchers().antMatchers("/user", "/login", "/logout", "/oauth/authorize", "/oauth_confirm_access", "/register", "/activate/**") .and() .authorizeRequests().antMatchers("/register", "/activate/**").permitAll() .and() .authorizeRequests().anyRequest().authenticated().and().csrf().disable(); }
@Override protected void configure(HttpSecurity http) throws Exception { SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler(); successHandler.setTargetUrlParameter("redirectTo"); http.authorizeRequests() .antMatchers(adminContextPath + "/assets/**").permitAll() .antMatchers(adminContextPath + "/login").permitAll() .anyRequest().authenticated() .and() .formLogin().loginPage(adminContextPath + "/login").successHandler(successHandler).and() .logout().logoutUrl(adminContextPath + "/logout").and() .httpBasic().and() .csrf().disable(); } }
@Override protected void configure(HttpSecurity http) throws Exception { // @formatter:off SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler(); successHandler.setTargetUrlParameter("redirectTo"); http.authorizeRequests() .antMatchers(adminContextPath + "/assets/**").permitAll() .antMatchers(adminContextPath + "/login").permitAll() .anyRequest().authenticated() .and() .formLogin().loginPage(adminContextPath + "/login").successHandler(successHandler).and() .logout().logoutUrl(adminContextPath + "/logout").and() .httpBasic().and() .csrf().disable(); // @formatter:on }
@Override protected void configure(HttpSecurity http) throws Exception { SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler(); successHandler.setTargetUrlParameter("redirectTo"); http.authorizeRequests() .antMatchers(adminContextPath + "/assets/**").permitAll() .antMatchers(adminContextPath + "/login").permitAll() .anyRequest().authenticated() .and() .formLogin().loginPage(adminContextPath + "/login").successHandler(successHandler).and() .logout().logoutUrl(adminContextPath + "/logout").and() .httpBasic().and() .csrf().disable(); } }
@Override protected void configure(HttpSecurity http) throws Exception { SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler(); successHandler.setTargetUrlParameter("redirectTo"); http.authorizeRequests() .antMatchers(adminContextPath + "/assets/**").permitAll() .antMatchers(adminContextPath + "/login").permitAll() .anyRequest().authenticated() .and() .formLogin().loginPage(adminContextPath + "/login").successHandler(successHandler).and() .logout().logoutUrl(adminContextPath + "/logout").and() .httpBasic().and() .csrf().disable(); } }
@Override protected void configure(HttpSecurity http) throws Exception { // @formatter:off SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler(); successHandler.setTargetUrlParameter("redirectTo"); http.authorizeRequests() .antMatchers(adminContextPath + "/assets/**").permitAll() .antMatchers(adminContextPath + "/login").permitAll() .anyRequest().authenticated() .and() .formLogin().loginPage(adminContextPath + "/login").successHandler(successHandler).and() .logout().logoutUrl(adminContextPath + "/logout").and() .httpBasic().and() .csrf().disable(); // @formatter:on } }
protected void applyPasswordAuthenticationConfig(HttpSecurity http) throws Exception { http.formLogin() .loginPage(SecurityConstants.DEFAULT_UNAUTHENTICATION_URL) // 登录页面回调 .loginProcessingUrl(SecurityConstants.DEFAULT_LOGIN_PROCESSING_URL_FORM) // 自定义的登录接口 .successHandler(myAuthenticationSuccessHandler) // 认证成功回调 .failureHandler(myAuthenticationFailureHandler); // 认证失败回调 }
protected void applyPasswordAuthenticationConfig(HttpSecurity http) throws Exception { http.formLogin() .loginPage(SecurityConstants.DEFAULT_UNAUTHENTICATION_URL) .loginProcessingUrl(SecurityConstants.DEFAULT_LOGIN_PROCESSING_URL_FORM) .successHandler(tihomAuthenticationSuccessHandler) .failureHandler(tihomAuthenticationFailureHandler); }
protected void applyPasswordAuthenticationConfig(HttpSecurity http) throws Exception { http.formLogin() .loginPage(SecurityConstants.DEFAULT_UNAUTHENTICATION_URL) .loginProcessingUrl(SecurityConstants.DEFAULT_LOGIN_PROCESSING_URL_FORM) .successHandler(imoocAuthenticationSuccessHandler) .failureHandler(imoocAuthenticationFailureHandler); }
@Override protected void configure(HttpSecurity http) throws Exception { SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler(); successHandler.setTargetUrlParameter("redirectTo"); http.headers().frameOptions().disable(); http.authorizeRequests() .antMatchers(adminContextPath + "/assets/**").permitAll() .antMatchers(adminContextPath + "/login").permitAll() .antMatchers("/hystrix/**").permitAll() .anyRequest().authenticated() .and() .formLogin().loginPage(adminContextPath + "/login").successHandler(successHandler).and() .logout().logoutUrl(adminContextPath + "/logout").and() .httpBasic().and() .csrf().disable(); } }
/** * Configure. * * @param http the http * @throws Exception the exception */ public void configure(HttpSecurity http) throws Exception { http.formLogin() .loginPage(SecurityConstants.DEFAULT_UNAUTHENTICATION_URL) .loginProcessingUrl(SecurityConstants.DEFAULT_SIGN_IN_PROCESSING_URL_FORM) .successHandler(authenticationSuccessHandler) .failureHandler(authenticationFailureHandler); }
@Override protected void configure(HttpSecurity http) throws Exception { String contextPath = sccaRestProperties.getContextPath(); http.authorizeRequests() .antMatchers(contextPath + "/**").authenticated() .anyRequest().permitAll() .and().formLogin().loginPage(contextPath + "/login").successHandler(authenticationSuccessHandler()).failureHandler(authenticationFailureHandler()).permitAll() .and().rememberMe().alwaysRemember(true) .and().logout().logoutUrl(contextPath + "/logout").logoutSuccessHandler(logoutSuccessHandler()).permitAll() .and().csrf().disable() .exceptionHandling().authenticationEntryPoint(restAuthenticationEntryPoint); }