Search in sources :

Example 1 with BasicAuthenticationEntryPoint

use of org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint in project spring-security-oauth by spring-projects.

the class AuthorizationServerSecurityConfigurer method registerDefaultAuthenticationEntryPoint.

@SuppressWarnings("unchecked")
private void registerDefaultAuthenticationEntryPoint(HttpSecurity http) {
    ExceptionHandlingConfigurer<HttpSecurity> exceptionHandling = http.getConfigurer(ExceptionHandlingConfigurer.class);
    if (exceptionHandling == null) {
        return;
    }
    if (authenticationEntryPoint == null) {
        BasicAuthenticationEntryPoint basicEntryPoint = new BasicAuthenticationEntryPoint();
        basicEntryPoint.setRealmName(realm);
        authenticationEntryPoint = basicEntryPoint;
    }
    ContentNegotiationStrategy contentNegotiationStrategy = http.getSharedObject(ContentNegotiationStrategy.class);
    if (contentNegotiationStrategy == null) {
        contentNegotiationStrategy = new HeaderContentNegotiationStrategy();
    }
    MediaTypeRequestMatcher preferredMatcher = new MediaTypeRequestMatcher(contentNegotiationStrategy, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_FORM_URLENCODED, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM, MediaType.APPLICATION_XML, MediaType.MULTIPART_FORM_DATA, MediaType.TEXT_XML);
    preferredMatcher.setIgnoredMediaTypes(Collections.singleton(MediaType.ALL));
    exceptionHandling.defaultAuthenticationEntryPointFor(postProcess(authenticationEntryPoint), preferredMatcher);
}
Also used : BasicAuthenticationEntryPoint(org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint) HttpSecurity(org.springframework.security.config.annotation.web.builders.HttpSecurity) HeaderContentNegotiationStrategy(org.springframework.web.accept.HeaderContentNegotiationStrategy) MediaTypeRequestMatcher(org.springframework.security.web.util.matcher.MediaTypeRequestMatcher) HeaderContentNegotiationStrategy(org.springframework.web.accept.HeaderContentNegotiationStrategy) ContentNegotiationStrategy(org.springframework.web.accept.ContentNegotiationStrategy)

Example 2 with BasicAuthenticationEntryPoint

use of org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint in project promregator by promregator.

the class BasicAuthenticationSpringConfiguration method basicAuthEntryPoint.

@Bean
public BasicAuthenticationEntryPoint basicAuthEntryPoint() {
    BasicAuthenticationEntryPoint bauth = new BasicAuthenticationEntryPoint();
    bauth.setRealmName("Promregator");
    return bauth;
}
Also used : BasicAuthenticationEntryPoint(org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint) Bean(org.springframework.context.annotation.Bean)

Example 3 with BasicAuthenticationEntryPoint

use of org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint in project atlas by apache.

the class AtlasSecurityConfig method getAuthenticationEntryPoint.

public BasicAuthenticationEntryPoint getAuthenticationEntryPoint() {
    BasicAuthenticationEntryPoint basicAuthenticationEntryPoint = new BasicAuthenticationEntryPoint();
    basicAuthenticationEntryPoint.setRealmName("atlas.com");
    return basicAuthenticationEntryPoint;
}
Also used : BasicAuthenticationEntryPoint(org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint)

Example 4 with BasicAuthenticationEntryPoint

use of org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint in project pivotal-cla by pivotalsoftware.

the class SecurityConfig method entryPoint.

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;
}
Also used : HttpStatusEntryPoint(org.springframework.security.web.authentication.HttpStatusEntryPoint) RequestMatcher(org.springframework.security.web.util.matcher.RequestMatcher) AntPathRequestMatcher(org.springframework.security.web.util.matcher.AntPathRequestMatcher) GitHubAuthenticationEntryPoint(io.pivotal.cla.security.GitHubAuthenticationEntryPoint) BasicAuthenticationEntryPoint(org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint) AntPathRequestMatcher(org.springframework.security.web.util.matcher.AntPathRequestMatcher) DelegatingAuthenticationEntryPoint(org.springframework.security.web.authentication.DelegatingAuthenticationEntryPoint) BasicAuthenticationEntryPoint(org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint) GitHubAuthenticationEntryPoint(io.pivotal.cla.security.GitHubAuthenticationEntryPoint) AuthenticationEntryPoint(org.springframework.security.web.AuthenticationEntryPoint) DelegatingAuthenticationEntryPoint(org.springframework.security.web.authentication.DelegatingAuthenticationEntryPoint) LinkedHashMap(java.util.LinkedHashMap)

Example 5 with BasicAuthenticationEntryPoint

use of org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint in project incubator-atlas by apache.

the class AtlasSecurityConfig method getAuthenticationEntryPoint.

public BasicAuthenticationEntryPoint getAuthenticationEntryPoint() {
    BasicAuthenticationEntryPoint basicAuthenticationEntryPoint = new BasicAuthenticationEntryPoint();
    basicAuthenticationEntryPoint.setRealmName("atlas.com");
    return basicAuthenticationEntryPoint;
}
Also used : BasicAuthenticationEntryPoint(org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint)

Aggregations

BasicAuthenticationEntryPoint (org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint)5 GitHubAuthenticationEntryPoint (io.pivotal.cla.security.GitHubAuthenticationEntryPoint)1 LinkedHashMap (java.util.LinkedHashMap)1 Bean (org.springframework.context.annotation.Bean)1 HttpSecurity (org.springframework.security.config.annotation.web.builders.HttpSecurity)1 AuthenticationEntryPoint (org.springframework.security.web.AuthenticationEntryPoint)1 DelegatingAuthenticationEntryPoint (org.springframework.security.web.authentication.DelegatingAuthenticationEntryPoint)1 HttpStatusEntryPoint (org.springframework.security.web.authentication.HttpStatusEntryPoint)1 AntPathRequestMatcher (org.springframework.security.web.util.matcher.AntPathRequestMatcher)1 MediaTypeRequestMatcher (org.springframework.security.web.util.matcher.MediaTypeRequestMatcher)1 RequestMatcher (org.springframework.security.web.util.matcher.RequestMatcher)1 ContentNegotiationStrategy (org.springframework.web.accept.ContentNegotiationStrategy)1 HeaderContentNegotiationStrategy (org.springframework.web.accept.HeaderContentNegotiationStrategy)1