Class SubjectX500PrincipalExtractor
java.lang.Object
org.springframework.security.web.authentication.preauth.x509.SubjectX500PrincipalExtractor
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.context.MessageSourceAware,X509PrincipalExtractor
public final class SubjectX500PrincipalExtractor
extends Object
implements X509PrincipalExtractor, org.springframework.context.MessageSourceAware
Extracts the principal from the
X500Principal.getName(String) returned by
X509Certificate.getSubjectX500Principal() passed into
extractPrincipal(X509Certificate) depending on the value of
setExtractPrincipalNameFromEmail(boolean).- Since:
- 7.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionextractPrincipal(X509Certificate clientCert) Returns the principal (usually a String) for the given certificate.voidsetExtractPrincipalNameFromEmail(boolean extractPrincipalNameFromEmail) Sets if the principal name should be extracted from the emailAddress or CN attribute (default).voidsetMessageSource(org.springframework.context.MessageSource messageSource)
-
Constructor Details
-
SubjectX500PrincipalExtractor
public SubjectX500PrincipalExtractor()
-
-
Method Details
-
extractPrincipal
Description copied from interface:X509PrincipalExtractorReturns the principal (usually a String) for the given certificate.- Specified by:
extractPrincipalin interfaceX509PrincipalExtractor
-
setMessageSource
public void setMessageSource(org.springframework.context.MessageSource messageSource) - Specified by:
setMessageSourcein interfaceorg.springframework.context.MessageSourceAware
-
setExtractPrincipalNameFromEmail
public void setExtractPrincipalNameFromEmail(boolean extractPrincipalNameFromEmail) Sets if the principal name should be extracted from the emailAddress or CN attribute (default). By default, the formatX500Principal.RFC2253is passed toX500Principal.getName(String)and the principal is extracted from the CN attribute as defined in Converting AttributeTypeAndValue of RFC2253. IfsetExtractPrincipalNameFromEmail(boolean)istrue, then the formatX500Principal.RFC2253is passed toX500Principal.getName(String)and the principal is extracted from the OID.1.2.840.113549.1.9.1 (emailAddress) attribute as defined in Section 2.3 of RFC1779.
-