public class SubjectDnX509PrincipalExtractor extends Object implements X509PrincipalExtractor
X509Certificate.getSubjectDN()
).
The regular expression should contain a single group; for example the default expression "CN=(.*?)(?:,|$)" matches the common name field. So "CN=Jimi Hendrix, OU=..." will give a user name of "Jimi Hendrix".
The matches are case insensitive. So "emailAddress=(.?)," will match "EMAILADDRESS=jimi@hendrix.org, CN=..." giving a user name "jimi@hendrix.org"
Modifier and Type | Field and Description |
---|---|
protected org.apache.commons.logging.Log |
logger |
protected org.springframework.context.support.MessageSourceAccessor |
messages |
Constructor and Description |
---|
SubjectDnX509PrincipalExtractor() |
Modifier and Type | Method and Description |
---|---|
Object |
extractPrincipal(X509Certificate clientCert)
Returns the principal (usually a String) for the given certificate.
|
void |
setMessageSource(org.springframework.context.MessageSource messageSource) |
void |
setSubjectDnRegex(String subjectDnRegex)
Sets the regular expression which will by used to extract the user name from the certificate's Subject
DN.
|
protected final org.apache.commons.logging.Log logger
protected org.springframework.context.support.MessageSourceAccessor messages
public Object extractPrincipal(X509Certificate clientCert)
X509PrincipalExtractor
extractPrincipal
in interface X509PrincipalExtractor
public void setSubjectDnRegex(String subjectDnRegex)
It should contain a single group; for example the default expression "CN=(.*?)(?:,|$)" matches the common name field. So "CN=Jimi Hendrix, OU=..." will give a user name of "Jimi Hendrix".
The matches are case insensitive. So "emailAddress=(.?)," will match "EMAILADDRESS=jimi@hendrix.org, CN=..." giving a user name "jimi@hendrix.org"
subjectDnRegex
- the regular expression to find in the subjectpublic void setMessageSource(org.springframework.context.MessageSource messageSource)
Copyright © 2019. All rights reserved.