Search in sources :

Example 1 with SubjectDnX509PrincipalExtractor

use of org.springframework.security.web.authentication.preauth.x509.SubjectDnX509PrincipalExtractor in project spring-security by spring-projects.

the class X509Configurer method getFilter.

private X509AuthenticationFilter getFilter(AuthenticationManager authenticationManager) {
    if (x509AuthenticationFilter == null) {
        x509AuthenticationFilter = new X509AuthenticationFilter();
        x509AuthenticationFilter.setAuthenticationManager(authenticationManager);
        if (subjectPrincipalRegex != null) {
            SubjectDnX509PrincipalExtractor principalExtractor = new SubjectDnX509PrincipalExtractor();
            principalExtractor.setSubjectDnRegex(subjectPrincipalRegex);
            x509AuthenticationFilter.setPrincipalExtractor(principalExtractor);
        }
        if (authenticationDetailsSource != null) {
            x509AuthenticationFilter.setAuthenticationDetailsSource(authenticationDetailsSource);
        }
        x509AuthenticationFilter = postProcess(x509AuthenticationFilter);
    }
    return x509AuthenticationFilter;
}
Also used : X509AuthenticationFilter(org.springframework.security.web.authentication.preauth.x509.X509AuthenticationFilter) SubjectDnX509PrincipalExtractor(org.springframework.security.web.authentication.preauth.x509.SubjectDnX509PrincipalExtractor)

Example 2 with SubjectDnX509PrincipalExtractor

use of org.springframework.security.web.authentication.preauth.x509.SubjectDnX509PrincipalExtractor in project spring-security by spring-projects.

the class SubjectDnX509PrincipalExtractorTests method setUp.

@Before
public void setUp() {
    extractor = new SubjectDnX509PrincipalExtractor();
    extractor.setMessageSource(new SpringSecurityMessageSource());
}
Also used : SpringSecurityMessageSource(org.springframework.security.core.SpringSecurityMessageSource) SubjectDnX509PrincipalExtractor(org.springframework.security.web.authentication.preauth.x509.SubjectDnX509PrincipalExtractor) Before(org.junit.Before)

Aggregations

SubjectDnX509PrincipalExtractor (org.springframework.security.web.authentication.preauth.x509.SubjectDnX509PrincipalExtractor)2 Before (org.junit.Before)1 SpringSecurityMessageSource (org.springframework.security.core.SpringSecurityMessageSource)1 X509AuthenticationFilter (org.springframework.security.web.authentication.preauth.x509.X509AuthenticationFilter)1