/** * Creates a new instance * @see HttpSecurity#formLogin() */ public FormLoginConfigurer() { super(new UsernamePasswordAuthenticationFilter(), null); usernameParameter("username"); passwordParameter("password"); }
/** * Creates a new instance * @see HttpSecurity#formLogin() */ public FormLoginConfigurer() { super(new UsernamePasswordAuthenticationFilter(), null); usernameParameter("username"); passwordParameter("password"); }
.and(). formLogin().usernameParameter("name") // 用户名参数 .passwordParameter("pwd") // 密码参数 .loginProcessingUrl("/loginAction") // 登录 Action 的 URI .loginPage("/login") // 登录页面 URI
/** * Creates a new instance * @see HttpSecurity#formLogin() */ public FormLoginConfigurer() { super(createUsernamePasswordAuthenticationFilter(),"/login"); usernameParameter("username"); passwordParameter("password"); }
/** * Creates a new instance * @see HttpSecurity#formLogin() */ public FormLoginConfigurer() { super(new UsernamePasswordAuthenticationFilter(), null); usernameParameter("username"); passwordParameter("password"); }
@Override protected void configure(HttpSecurity http) throws Exception { http. authorizeRequests() .antMatchers("/").permitAll() .antMatchers("/login").permitAll() .antMatchers("/registration").permitAll() .antMatchers("/admin/**").hasAuthority("ADMIN").anyRequest() .authenticated().and().csrf().disable().formLogin() .loginPage("/login").failureUrl("/login?error=true") .defaultSuccessUrl("/admin/home") .usernameParameter("email") .passwordParameter("password") .and().logout() .logoutRequestMatcher(new AntPathRequestMatcher("/logout")) .logoutSuccessUrl("/").and().exceptionHandling() .accessDeniedPage("/access-denied"); }
@Override protected void configure(HttpSecurity http) throws Exception { http. authorizeRequests() .antMatchers("/").permitAll() .antMatchers("/login").permitAll() .antMatchers("/registration").permitAll() .antMatchers("/admin/**").hasAuthority("ADMIN").anyRequest() .authenticated().and().csrf().disable().formLogin() .loginPage("/login").failureUrl("/login?error=true") .defaultSuccessUrl("/admin/home") .usernameParameter("email") .passwordParameter("password") .and().logout() .logoutRequestMatcher(new AntPathRequestMatcher("/logout")) .logoutSuccessUrl("/").and().exceptionHandling() .accessDeniedPage("/access-denied"); }
@Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() .antMatchers("/account/**") .authenticated() .and() .formLogin() .usernameParameter("username") .passwordParameter("password") .loginPage("/login") .successHandler(successHandler) .failureHandler(failureHandler) .permitAll() .and() .logout() .invalidateHttpSession(true) .and() .csrf() .disable(); } }
@Override protected void configure(HttpSecurity http) throws Exception { if (ShepherConstants.LOGIN_TYPE_LDAP.equals(loginType.toUpperCase())) { http.csrf().disable() .authorizeRequests() .anyRequest() .fullyAuthenticated() .and() .formLogin(); } else if (ShepherConstants.LOGIN_TYPE_CAS.equals(loginType.toUpperCase())) { http.csrf().disable().addFilter(new UsernamePasswordAuthenticationFilter()) .addFilterBefore(casAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class) .addFilterAfter(getCas20ProxyReceivingTicketValidationFilter(), AuthenticationFilter.class); } else if (ShepherConstants.LOGIN_TYPE_DEMO.equals(loginType.toUpperCase())) { http.csrf().disable() .authorizeRequests() .anyRequest().hasRole("USER") .and() .formLogin() .loginPage("/login") .passwordParameter("password") .usernameParameter("username") .permitAll() .and() .logout() .permitAll(); } }
@Override protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .antMatchers("/login","/logout.do").permitAll() .antMatchers("/**").authenticated() .and() .formLogin() .loginProcessingUrl("/login.do") .usernameParameter("username") .passwordParameter("password") .loginPage("/login") .and() .logout() .logoutRequestMatcher(new AntPathRequestMatcher("/logout.do")) .and() .userDetailsService(userDetailsServiceBean()); }
.usernameParameter("username").passwordParameter("password").permitAll(); if (successLogoutHandler == null) { httpSecurity.logout().logoutSuccessUrl("/").deleteCookies("JSESSIONID");
.loginProcessingUrl(LOGIN_PATH) .usernameParameter(Parameters.USERNAME) .passwordParameter(Parameters.PASSWORD) .successHandler(authSuccessHandler) .failureHandler(authFailureHandler)
@Override protected void configure(HttpSecurity http) throws Exception { CookieAuthenticationFilter cookieAuthenticationFilter = new CookieAuthenticationFilter(ssoTokenRedisRepository()); cookieAuthenticationFilter.setAuthenticationManager(authenticationManager()); cookieAuthenticationFilter.setCheckForPrincipalChanges(true); cookieAuthenticationFilter.setInvalidateSessionOnPrincipalChange(true); http .addFilter(cookieAuthenticationFilter) .authorizeRequests() .antMatchers("/mappings/**","/env/**","/health/**","/metrics/**","/trace/**","/dump/**","/beans/**","/info/**","/autoconfig/**","/configprops/**","/logfile/**","/jolokia/**").permitAll() .anyRequest().authenticated() .and() .formLogin() .loginPage("/login") .usernameParameter("username") .passwordParameter("password") .successHandler(customAuth()) .permitAll().and() .logout() .logoutSuccessHandler(customLogout()) .logoutUrl("/logout") .and() .csrf().disable(); }
.formLogin().loginPage(Url.Page.User.LOGIN).usernameParameter(Url.Page.User.LOGIN_ACCOUNT_STRING).passwordParameter(Url.Page.User.LOGIN_PASSWORD_STRING)
.loginPage("/login") .usernameParameter("email") .passwordParameter("password") .failureUrl("/login?error=true") .defaultSuccessUrl("/")
/** * The method configure is responsible for the security configuration. * * @param httpSecurity httpSecurity will be used to configure the authentication process. * @throws Exception Throws an exception if the configuration fails */ @Override protected void configure(final HttpSecurity httpSecurity) throws Exception { httpSecurity .authorizeRequests() .antMatchers("/web/**") .authenticated() .and() .formLogin() .loginPage("/login").failureUrl("/login?error") .usernameParameter("username") .passwordParameter("password") .and() .logout() .logoutSuccessUrl("/login?logout") .and() .csrf().and().rememberMe().tokenRepository(tokenRepository).tokenValiditySeconds(tokenValiditySeconds) .and().exceptionHandling().accessDeniedPage("/forbidden"); httpSecurity.headers().cacheControl().disable(); }
.failureHandler(failureHandler) .usernameParameter("j_username") .passwordParameter("j_password") .and() .logout()
.formLogin() .usernameParameter(usernameParameter) .passwordParameter(passwordParameter)
.usernameParameter(props.auth().getLoginKey()).passwordParameter(props.auth().getPasswordKey()) .successHandler(loginHandler).failureHandler(loginHandler) .permitAll()