|
34 | 34 | import org.springframework.util.Assert;
|
35 | 35 |
|
36 | 36 | /**
|
37 |
| - * Obtains the principal from a certificate using RFC2253 and RFC1779 formats. By default, |
38 |
| - * RFC2253 is used: DN is extracted from CN. If extractPrincipalNameFromEmail is true then |
39 |
| - * format RFC1779 will be used: DN is extracted from EMAIlADDRESS. |
| 37 | + * Extracts the principal from the {@link X500Principal#getName(String)} returned by |
| 38 | + * {@link X509Certificate#getSubjectX500Principal()} passed into |
| 39 | + * {@link #extractPrincipal(X509Certificate)} depending on the value of |
| 40 | + * {@link #setExtractPrincipalNameFromEmail(boolean)}. |
40 | 41 | *
|
41 | 42 | * @author Max Batischev
|
42 | 43 | * @author Rob Winch
|
@@ -80,8 +81,26 @@ public void setMessageSource(MessageSource messageSource) {
|
80 | 81 | }
|
81 | 82 |
|
82 | 83 | /**
|
83 |
| - * If true then DN will be extracted from EMAIlADDRESS, defaults to {@code false} |
84 |
| - * @param extractPrincipalNameFromEmail whether to extract DN from EMAIlADDRESS |
| 84 | + * Sets if the principal name should be extracted from the emailAddress or CN |
| 85 | + * attribute (default). |
| 86 | + * |
| 87 | + * By default, the format {@link X500Principal#RFC2253} is passed to |
| 88 | + * {@link X500Principal#getName(String)} and the principal is extracted from the CN |
| 89 | + * attribute as defined in |
| 90 | + * <a href="https://datatracker.ietf.org/doc/html/rfc2253#section-2.3">Converting |
| 91 | + * AttributeTypeAndValue of RFC2253</a>. |
| 92 | + * |
| 93 | + * If {@link #setExtractPrincipalNameFromEmail(boolean)} is {@code true}, then the |
| 94 | + * format {@link X500Principal#RFC2253} is passed to |
| 95 | + * {@link X500Principal#getName(String)} and the principal is extracted from the |
| 96 | + * <a href="https://oid-base.com/get/1.2.840.113549.1.9.1">OID.1.2.840.113549.1.9.1 |
| 97 | + * (emailAddress)</a> attribute as defined in |
| 98 | + * <a href="https://datatracker.ietf.org/doc/html/rfc1779#section-2.3">Section 2.3 of |
| 99 | + * RFC1779</a>. |
| 100 | + * @param extractPrincipalNameFromEmail whether to extract the principal from the |
| 101 | + * emailAddress (default false) |
| 102 | + * @see <a href="https://datatracker.ietf.org/doc/html/rfc2253">RFC2253</a> |
| 103 | + * @see <a href="https://datatracker.ietf.org/doc/html/rfC1779">RFC1779</a> |
85 | 104 | */
|
86 | 105 | public void setExtractPrincipalNameFromEmail(boolean extractPrincipalNameFromEmail) {
|
87 | 106 | if (extractPrincipalNameFromEmail) {
|
|
0 commit comments