Example usage for org.springframework.security.web.authentication LoginUrlAuthenticationEntryPoint LoginUrlAuthenticationEntryPoint

List of usage examples for org.springframework.security.web.authentication LoginUrlAuthenticationEntryPoint LoginUrlAuthenticationEntryPoint

Introduction

In this page you can find the example usage for org.springframework.security.web.authentication LoginUrlAuthenticationEntryPoint LoginUrlAuthenticationEntryPoint.

Prototype

public LoginUrlAuthenticationEntryPoint(String loginFormUrl) 

Source Link

Usage

From source file:com.vaadinspring.components.SecurityConfig.java

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

    http.authorizeRequests().antMatchers("/maga").anonymous().antMatchers("/#!main").access("hasRole('user')")
            .antMatchers("/#!admin").access("hasRole('admin')").and().formLogin().loginPage("/")
            .loginProcessingUrl("/login").defaultSuccessUrl("/#!main").failureUrl("/error")
            .usernameParameter("username").passwordParameter("password").and().logout()
            .logoutSuccessUrl("/logout").and().exceptionHandling()
            .authenticationEntryPoint(new LoginUrlAuthenticationEntryPoint("/main")).and().csrf().disable();

}

From source file:com.vaadinspringtemplate.security.SecurityConfig.java

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

    http.authorizeRequests().antMatchers("/maga").anonymous().antMatchers("/#!main").access("hasRole('user')")
            .antMatchers("/#!admin").access("hasRole('admin')").and().formLogin().loginPage("/")
            .loginProcessingUrl("/login").defaultSuccessUrl("/#!main").failureUrl("/error")
            .usernameParameter("username").passwordParameter("password").and().logout()
            .logoutSuccessUrl("/logout").and().exceptionHandling()
            .authenticationEntryPoint(new LoginUrlAuthenticationEntryPoint("/main")).and().csrf().disable();
}

From source file:com.github.djabry.platform.rest.config.WebSecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests().anyRequest().permitAll().and().csrf().disable().exceptionHandling()
            .authenticationEntryPoint(new LoginUrlAuthenticationEntryPoint("/"))
            //.formLogin().defaultSuccessUrl("/").permitAll()
            .and().logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout")).logoutSuccessUrl("/")
            .permitAll();/*from   w  w w  .  ja  v  a  2  s  . co  m*/
}

From source file:com.github.djabry.platform.vaadin.config.WebSecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests()//from   w ww.  ja  v a  2s . c o  m
            //.antMatchers("/VAADIN/**", "/PUSH/**", "/UIDL/**", "/login", "/login/**", "/register", "/environment").permitAll()
            //.antMatchers("/**").fullyAuthenticated()
            .anyRequest().permitAll().and().csrf().disable().exceptionHandling()
            .authenticationEntryPoint(new LoginUrlAuthenticationEntryPoint("/"))
            //.formLogin().defaultSuccessUrl("/").permitAll()
            .and()

            .logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout")).logoutSuccessUrl("/")
            .permitAll();
}

From source file:com.hp.autonomy.frontend.find.idol.beanconfiguration.IdolSecurity.java

@SuppressWarnings("ProhibitedExceptionDeclared")
@Override/*from  w w w  .ja  va2 s.c o  m*/
protected void configure(final HttpSecurity http) throws Exception {
    final LinkedHashMap<RequestMatcher, AuthenticationEntryPoint> entryPoints = new LinkedHashMap<>();
    entryPoints.put(new AntPathRequestMatcher("/api/**"), new Http403ForbiddenEntryPoint());
    entryPoints.put(AnyRequestMatcher.INSTANCE,
            new LoginUrlAuthenticationEntryPoint(FindController.DEFAULT_LOGIN_PAGE));
    final AuthenticationEntryPoint authenticationEntryPoint = new DelegatingAuthenticationEntryPoint(
            entryPoints);

    http.csrf().disable().exceptionHandling().authenticationEntryPoint(authenticationEntryPoint)
            .accessDeniedPage("/authentication-error").and().logout().logoutUrl("/logout")
            .logoutSuccessUrl(FindController.DEFAULT_LOGIN_PAGE).and().authorizeRequests()
            .antMatchers(FindController.APP_PATH + "**").hasAnyRole(FindRole.USER.name())
            .antMatchers(FindController.CONFIG_PATH).hasRole(FindRole.CONFIG.name())
            .antMatchers("/api/public/**").hasRole(FindRole.USER.name()).antMatchers("/api/bi/**")
            .hasRole(FindRole.BI.name()).antMatchers("/api/config/**").hasRole(FindRole.CONFIG.name())
            .antMatchers("/api/admin/**").hasRole(FindRole.ADMIN.name())
            .antMatchers(FindController.DEFAULT_LOGIN_PAGE).permitAll().antMatchers(FindController.LOGIN_PATH)
            .permitAll().antMatchers("/").permitAll().anyRequest().denyAll().and().headers().defaultsDisabled()
            .frameOptions().sameOrigin();

    idolSecurityCustomizer.customize(http, authenticationManager());
}

From source file:com.emusic.SecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    // @formatter:off   
    http.antMatcher("/**").authorizeRequests()
            .antMatchers("/", "/login**", "/webjars/**", "/views/**", "/products").permitAll().anyRequest()
            .authenticated().and().exceptionHandling()
            .authenticationEntryPoint(new LoginUrlAuthenticationEntryPoint("/")).and().logout()
            .logoutSuccessUrl("/").permitAll().and().csrf().csrfTokenRepository(csrfTokenRepository()).and()
            .addFilterAfter(csrfHeaderFilter(), CsrfFilter.class)
            .addFilterBefore(ssoFilter(), BasicAuthenticationFilter.class);
    // @formatter:on
}

From source file:com.github.bonndan.fullofstars.FOSApplication.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    // @formatter:off   
    http.antMatcher("/**").authorizeRequests().antMatchers("/", "/login**", "/webjars/**").permitAll()
            .anyRequest().authenticated().and().exceptionHandling()
            .authenticationEntryPoint(new LoginUrlAuthenticationEntryPoint("/")).and().logout()
            .logoutSuccessUrl("/").permitAll().and().csrf().csrfTokenRepository(csrfTokenRepository()).and()
            .addFilterAfter(csrfHeaderFilter(), CsrfFilter.class)
            .addFilterBefore(ssoFilter(), BasicAuthenticationFilter.class);
    // @formatter:on
}

From source file:de.dominikschadow.duke.encounters.config.WebSecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    // @formatter:off
    http.authorizeRequests().antMatchers("/", "/register", "/encounters", "/search", "/error").permitAll()
            .antMatchers("/admin/**").hasRole("ADMIN").anyRequest().authenticated().and().formLogin()
            .loginPage("/login").defaultSuccessUrl("/account").permitAll().and().exceptionHandling()
            .authenticationEntryPoint(new LoginUrlAuthenticationEntryPoint("/login")).and().logout()
            .logoutSuccessUrl("/").permitAll().and().rememberMe().and().securityContext()
            .securityContextRepository(securityContextRepository).and().headers()
            .addHeaderWriter(new StaticHeadersWriter("Content-Security-Policy", "default-src 'self'")).and()
            .addFilterBefore(ssoFilter(), BasicAuthenticationFilter.class);
    // @formatter:on
}

From source file:org.lightadmin.core.config.context.LightAdminSecurityConfiguration.java

@Bean
public Filter exceptionTranslationFilter(RequestCache requestCache) {
    AccessDeniedHandlerImpl accessDeniedHandler = new AccessDeniedHandlerImpl();
    accessDeniedHandler.setErrorPage(applicationUrl("/access-denied"));
    LoginUrlAuthenticationEntryPoint authenticationEntryPoint = new LoginUrlAuthenticationEntryPoint(
            applicationUrl("/login"));
    ExceptionTranslationFilter exceptionTranslationFilter = new ExceptionTranslationFilter(
            authenticationEntryPoint, requestCache);
    exceptionTranslationFilter.setAccessDeniedHandler(accessDeniedHandler);
    return exceptionTranslationFilter;
}

From source file:architecture.user.spring.config.SecurityConfig.java

@Bean(name = "loginUrlAuthenticationEntryPoint")
public AuthenticationEntryPoint loginUrlAuthenticationEntryPoint() {
    return new LoginUrlAuthenticationEntryPoint("/accounts/login");
}