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

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

Introduction

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

Prototype

public DelegatingAuthenticationEntryPoint(LinkedHashMap<RequestMatcher, AuthenticationEntryPoint> entryPoints) 

Source Link

Usage

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

@SuppressWarnings("ProhibitedExceptionDeclared")
@Override//from   w w w  .  j a v a2  s  . co  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:io.pivotal.cla.config.SecurityConfig.java

private AuthenticationEntryPoint entryPoint() {
    LinkedHashMap<RequestMatcher, AuthenticationEntryPoint> entryPoints = new LinkedHashMap<>();
    entryPoints.put(new AntPathRequestMatcher("/github/hooks/**"),
            new HttpStatusEntryPoint(HttpStatus.UNAUTHORIZED));
    entryPoints.put(new AntPathRequestMatcher("/admin/**"), new GitHubAuthenticationEntryPoint(
            oauthConfig.getMain(), "user:email,repo:status,admin:repo_hook,admin:org_hook,read:org"));
    BasicAuthenticationEntryPoint basicEntryPoint = new BasicAuthenticationEntryPoint();
    basicEntryPoint.setRealmName("Pivotal CLA");
    entryPoints.put(new AntPathRequestMatcher("/manage/**"), basicEntryPoint);
    DelegatingAuthenticationEntryPoint entryPoint = new DelegatingAuthenticationEntryPoint(entryPoints);
    entryPoint.setDefaultEntryPoint(new GitHubAuthenticationEntryPoint(oauthConfig.getMain(), "user:email"));
    return entryPoint;
}

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

@Bean(name = "authenticationEntryPoint")
public DelegatingAuthenticationEntryPoint authenticationEntryPoint() {
    LinkedHashMap<RequestMatcher, AuthenticationEntryPoint> entryPoints = new LinkedHashMap<RequestMatcher, AuthenticationEntryPoint>();
    entryPoints.put(nonAjaxRequestMatcher(), loginUrlAuthenticationEntryPoint());
    DelegatingAuthenticationEntryPoint authenticationEntryPoint = new DelegatingAuthenticationEntryPoint(
            entryPoints);//w  w  w.  j  a va  2s  . c  o m
    authenticationEntryPoint.setDefaultEntryPoint(new Http403ForbiddenEntryPoint());
    return authenticationEntryPoint;
}

From source file:org.opendatakit.configuration.SecurityConfiguration.java

@Bean
DelegatingAuthenticationEntryPoint delegatingAuthenticationEntryPoint()
        throws ODKEntityNotFoundException, ODKOverQuotaException, ODKDatastoreException, PropertyVetoException {
    LinkedHashMap<RequestMatcher, AuthenticationEntryPoint> entryPoints = new LinkedHashMap<RequestMatcher, AuthenticationEntryPoint>();
    entryPoints.put(new RequestHeaderRequestMatcher("X-OpenRosa-Version", "1.0"), digestEntryPoint());
    entryPoints.put(new RequestHeaderRequestMatcher("X-OpenDataKit-Version", "2.0"), digestEntryPoint());
    DelegatingAuthenticationEntryPoint delegatingAuthenticationEntryPoint = new DelegatingAuthenticationEntryPoint(
            entryPoints);/* ww w . j av a2s .c  o m*/
    delegatingAuthenticationEntryPoint.setDefaultEntryPoint(digestEntryPoint());
    return delegatingAuthenticationEntryPoint;
}

From source file:org.apache.atlas.web.security.AtlasSecurityConfig.java

public DelegatingAuthenticationEntryPoint getDelegatingAuthenticationEntryPoint() {
    LinkedHashMap<RequestMatcher, AuthenticationEntryPoint> entryPointMap = new LinkedHashMap<>();
    entryPointMap.put(new RequestHeaderRequestMatcher("User-Agent", "Mozilla"), atlasAuthenticationEntryPoint);
    DelegatingAuthenticationEntryPoint entryPoint = new DelegatingAuthenticationEntryPoint(entryPointMap);
    entryPoint.setDefaultEntryPoint(getAuthenticationEntryPoint());
    return entryPoint;
}