Example usage for org.springframework.security.config.annotation.web.builders HttpSecurity formLogin

List of usage examples for org.springframework.security.config.annotation.web.builders HttpSecurity formLogin

Introduction

In this page you can find the example usage for org.springframework.security.config.annotation.web.builders HttpSecurity formLogin.

Prototype

public FormLoginConfigurer<HttpSecurity> formLogin() throws Exception 

Source Link

Document

Specifies to support form based authentication.

Usage

From source file:org.zalando.example.zauth.config.SecurityConfig.java

@Override
protected void configure(final HttpSecurity http) throws Exception {

    http.formLogin().loginPage("/signin").failureUrl("/signin?param.error=bad_credentials").permitAll().and()
            .logout().logoutUrl("/logout").deleteCookies("JSESSIONID").permitAll().and().authorizeRequests()
            .antMatchers("/favicon.ico", "/static-resources/**", "/css/**", "/js/**").permitAll()
            .antMatchers("/**").authenticated().and().rememberMe().and().apply(new SpringSocialConfigurer())
            .and().csrf().disable();/*  w  ww .  ja  v  a 2  s . c  o m*/
}

From source file:top.zhacker.passport.client.showcase.config.SecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.formLogin().loginPage("/signin").loginProcessingUrl("/signin/authenticate")
            .defaultSuccessUrl("/connect").failureUrl("/signin?param.error=bad_credentials").and().logout()
            .logoutUrl("/signout").deleteCookies("JSESSIONID").and().authorizeRequests()
            .antMatchers("/", "/webjars/**", "/admin/**", "/favicon.ico", "/resources/**", "/auth/**",
                    "/signin/**", "/signup/**", "/disconnect/facebook")
            .permitAll().antMatchers("/**").authenticated().and().rememberMe();
}

From source file:com.ce.app.config.SecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {

    // @formatter:off

    http.formLogin().loginPage("/cms/login").defaultSuccessUrl("/cms/home").and().authorizeRequests()
            .antMatchers("/welcome/**", "/auth/**", "/cms/register/**", "/cms/login", "/logout/**").permitAll()
            .anyRequest().authenticated().and().csrf().disable();

    // @formatter:on
}

From source file:org.dawnsci.marketplace.config.SecurityConfiguration.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.formLogin().loginPage("/signin").loginProcessingUrl("/signin/authenticate")
            .failureUrl("/signin?param.error=bad_credentials").and().logout().logoutUrl("/signout")
            .deleteCookies("JSESSIONID").and().authorizeRequests().antMatchers("/**").permitAll()
            .antMatchers(HttpMethod.POST, "/**").authenticated().antMatchers(HttpMethod.PUT, "/**")
            .authenticated().antMatchers(HttpMethod.DELETE, "/**").authenticated().and().httpBasic().and()
            .rememberMe();/*ww w  .ja v a2  s .c  o m*/
}

From source file:rd.kpath.config.SecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.formLogin().loginPage("/signin").loginProcessingUrl("/signin/authenticate")
            .failureUrl("/signin?param.error=bad_credentials").and().logout().logoutUrl("/signout")
            .deleteCookies("JSESSIONID").and().authorizeRequests()
            .antMatchers("/admin/**", "/favicon.ico", "/resources/**", "/auth/**", "/signin/**", "/signup/**",
                    "/disconnect/facebook")
            .permitAll().antMatchers("/**").authenticated().and().rememberMe().and()
            .apply(new SpringSocialConfigurer());
}

From source file:org.zaizi.sensefy.auth.LoginConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {

    http.formLogin().loginPage("/login").permitAll().and().requestMatchers()
            .antMatchers("/login", "/oauth/authorize", "/oauth/confirm_access").and().authorizeRequests()
            .anyRequest().authenticated().and().csrf().csrfTokenRepository(csrfTokenRepository()).and()
            .addFilterAfter(csrfHeaderFilter(), CsrfFilter.class);

}

From source file:io.spring.springoverflow.configuration.WebSecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests().antMatchers("/**").permitAll();

    http.formLogin().loginPage("/login").permitAll().and().logout().logoutSuccessUrl("/").permitAll();
}

From source file:ua.com.rocketlv.spb.WebSecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests().antMatchers("/").permitAll().anyRequest().authenticated();
    http.formLogin().loginPage("/login").permitAll().and().logout().permitAll();

}

From source file:shiver.me.timbers.security.web.advanced.SecurityConfiguration.java

@Override
protected void configureFurther(HttpSecurity http) throws Exception {
    http.authorizeRequests().anyRequest().authenticated();
    http.formLogin().loginPage("/spring/signIn").permitAll();
    http.logout().logoutUrl("/spring/signOut").logoutSuccessUrl("/spring/");
}

From source file:ca.unx.template.config.SpringSecurityConfiguration.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests().antMatchers("/admin/**").hasRole("ADMIN").anyRequest().permitAll();

    http.formLogin().and().httpBasic();
}