|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.security.web.authentication.preauth.x509.SubjectDnX509PrincipalExtractor
public class SubjectDnX509PrincipalExtractor
Obtains the principal from a certificate using a regular expression match against the Subject (as returned by a call
to 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 "[email protected], CN=..." giving a user name "[email protected]"
Field Summary | |
---|---|
protected org.apache.commons.logging.Log |
logger
|
protected MessageSourceAccessor |
messages
|
Constructor Summary | |
---|---|
SubjectDnX509PrincipalExtractor()
|
Method Summary | |
---|---|
Object |
extractPrincipal(X509Certificate clientCert)
Returns the principal (usually a String) for the given certificate. |
void |
setMessageSource(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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final org.apache.commons.logging.Log logger
protected MessageSourceAccessor messages
Constructor Detail |
---|
public SubjectDnX509PrincipalExtractor()
Method Detail |
---|
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 "[email protected], CN=..." giving a user name "[email protected]"
subjectDnRegex
- the regular expression to find in the subjectpublic void setMessageSource(MessageSource messageSource)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |