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:com.kazuki43zoo.jpetstore.config.WebSecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.formLogin().loginPage("/login").defaultSuccessUrl("/catalog").permitAll();
    http.logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout")).logoutSuccessUrl("/catalog")
            .deleteCookies("JSESSIONID").permitAll();
    http.authorizeRequests().mvcMatchers("/my/**").authenticated().anyRequest().permitAll();
}

From source file:net.prasenjit.security.login.SecurityConfiguration.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.formLogin().and().authorizeRequests().antMatchers("/oauth/token").anonymous().anyRequest()
            .authenticated().and().sessionManagement().sessionCreationPolicy(SessionCreationPolicy.NEVER);
}

From source file:com.greglturnquist.spring.social.ecobee.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("/main.css", "/bower_components/**", "/img/**", "/favicon.ico", "/auth/**",
                    "/signin/**", "/signup/**")
            .permitAll().antMatchers("/**").authenticated().and().rememberMe();

}

From source file:rzd.vivc.documentexamination.configuration.WebSecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.formLogin().loginPage("/login").and().logout().logoutSuccessUrl("/")
            .logoutRequestMatcher(new AntPathRequestMatcher("/logout")).deleteCookies("remove")
            .invalidateHttpSession(true).and().authorizeRequests().antMatchers("/director/**")
            .hasRole("DIRECTOR").antMatchers("/admin/**").hasRole("ADMIN").antMatchers("/user/**")
            .hasAnyRole("USER", "DIRECTOR").anyRequest().permitAll().and().csrf().disable();
    /** .and()/*  ww  w .  jav a 2  s .c om*/
        //    , ?    https.  ?  ? https
     .requiresChannel().antMatchers("/users/**","/user**","/login").requiresSecure()**/
    ;
}

From source file:org.ingini.spring.boot.mongodb.config.SecurityConfig.java

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

    http.formLogin().defaultSuccessUrl("/resource").and().logout().and().authorizeRequests()
            .antMatchers("/index.html", "/home.html", "/login.html", "/", "/access", "/logout").permitAll()
            .anyRequest().authenticated().and().csrf().disable();
}

From source file:xyz.autumnn.exam.springsocial.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().csrf().and()
            .apply(new SpringSocialConfigurer());
}

From source file:com.icm.taskmanager.web.security.SpringSecurityConfig.java

@Override
protected void configure(final HttpSecurity http) throws Exception {
    http.formLogin().loginPage("/login.html").successForwardUrl("/loginok.html").failureUrl("/login-error.html")
            .and().logout().logoutSuccessUrl("/").and().authorizeRequests().antMatchers("/manager/**")
            .hasRole("MANAGER").antMatchers("/employee/**").hasRole("EMPLOYEE").and().rememberMe()
            .key("rem-me-key").rememberMeParameter("remember-me-param").rememberMeCookieName("my-remember-me")
            .tokenValiditySeconds(86400);

}

From source file:org.consultjr.mvc.core.config.security.ApplicationSecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.formLogin().loginPage("/login").failureUrl("/login?error").usernameParameter("username")
            .passwordParameter("password").and().logout().logoutSuccessUrl("/login?logout").and().csrf().and()
            .exceptionHandling().accessDeniedPage("/403").and().authorizeRequests()
            .antMatchers("/", "/login/**", "/signup/**", "/about/**", "/support/**", "/contact/**",
                    "/Public/**", // for public content... CMS, Ajax, etc
                    "/System/install/**", "/User/edit/**", "/User/panel/**")
            .permitAll().antMatchers("/Client/**").hasAuthority("client").antMatchers("/Admin/**", "/User/**")
            .hasAuthority("admin").anyRequest().authenticated();
}

From source file:ro.teamnet.hero.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();

}

From source file:com.kdubb.socialshowcaseboot.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();
}