org.springframework.security.web.util.matcher.RequestHeaderRequestMatcher Java Examples

The following examples show how to use org.springframework.security.web.util.matcher.RequestHeaderRequestMatcher. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AtlasSecurityConfig.java    From atlas with Apache License 2.0 6 votes vote down vote up
public AuthenticationEntryPoint getAuthenticationEntryPoint() throws Exception {
    AuthenticationEntryPoint authenticationEntryPoint;

    if (keycloakEnabled) {
        KeycloakAuthenticationEntryPoint keycloakAuthenticationEntryPoint = new KeycloakAuthenticationEntryPoint(adapterDeploymentContext());
        keycloakAuthenticationEntryPoint.setRealm("atlas.com");
        keycloakAuthenticationEntryPoint.setLoginUri("/login.jsp");
        authenticationEntryPoint = keycloakAuthenticationEntryPoint;
    } else {
        LinkedHashMap<RequestMatcher, AuthenticationEntryPoint> entryPointMap = new LinkedHashMap<>();
        entryPointMap.put(new RequestHeaderRequestMatcher(HeadersUtil.USER_AGENT_KEY, HeadersUtil.USER_AGENT_VALUE), atlasAuthenticationEntryPoint);
        AtlasDelegatingAuthenticationEntryPoint basicAuthenticationEntryPoint = new AtlasDelegatingAuthenticationEntryPoint(entryPointMap);
        authenticationEntryPoint = basicAuthenticationEntryPoint;
    }
    return authenticationEntryPoint;
}
 
Example #2
Source File: AtlasSecurityConfig.java    From atlas with Apache License 2.0 5 votes vote down vote up
public DelegatingAuthenticationEntryPoint getDelegatingAuthenticationEntryPoint() throws Exception {
    LinkedHashMap<RequestMatcher, AuthenticationEntryPoint> entryPointMap = new LinkedHashMap<>();
    entryPointMap.put(new RequestHeaderRequestMatcher(HeadersUtil.USER_AGENT_KEY, HeadersUtil.USER_AGENT_VALUE), atlasAuthenticationEntryPoint);
    DelegatingAuthenticationEntryPoint entryPoint = new DelegatingAuthenticationEntryPoint(entryPointMap);
    entryPoint.setDefaultEntryPoint(getAuthenticationEntryPoint());
    return entryPoint;
}
 
Example #3
Source File: HeaderAuthenticationFilter.java    From juiser with Apache License 2.0 5 votes vote down vote up
public HeaderAuthenticationFilter(String headerName, AuthenticationManager authenticationManager) {
    Assert.hasText(headerName, "headerName cannot be null or empty.");
    Assert.notNull("AuthenticationManager is required.");
    this.headerName = headerName;
    this.requiresAuthenticationRequestMatcher = new RequestHeaderRequestMatcher(headerName, null);
    this.authenticationManager = authenticationManager;
}
 
Example #4
Source File: AtlasSecurityConfig.java    From incubator-atlas with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #5
Source File: TokenAuthenticationFilter.java    From ChengFeng1.5 with MIT License 4 votes vote down vote up
public TokenAuthenticationFilter() {
	//拦截header含Authorization的请求
	this.requiresAuthenticationRequestMatcher = new RequestHeaderRequestMatcher("Authorization");
}
 
Example #6
Source File: CrustAuthenticationFilter.java    From Milkomeda with MIT License 4 votes vote down vote up
CrustAuthenticationFilter() {
    // 配置拦截匹配请求头
    String tokenName = ApplicationContextHolder.get().getBean(CrustProperties.class).getTokenName();
    this.requiresAuthenticationRequestMatcher = new RequestHeaderRequestMatcher(tokenName);
}
 
Example #7
Source File: OAuth2SecurityConfiguration.java    From flair-registry with Apache License 2.0 4 votes vote down vote up
@Bean
@Qualifier("authorizationHeaderRequestMatcher")
public RequestMatcher authorizationHeaderRequestMatcher() {
    return new RequestHeaderRequestMatcher("Authorization");
}