Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Done
-
4.8.3.Final
-
None
-
-
NEW
-
NEW
Description
I am currently working on configuring keycloak for X.509 certificate login.
We store the whole user certificate's subject DN as user attribute. During the login we match the authentication certificate's subjectDN against the value stored in the user attributes.
The subject DN is determined executing:
cert.getSubjectDN().getName()
Here we have a problem regarding the subject DN order. We realized that the subject DN order is security provider specific:
- Using SUN security provider we get a subject DN like:
"EMAILADDRESS=bjensen@example.com, CN=Ms. Barbara J Jensen III, O=example.com, ST=California, C=US" - Using BouncyCastle security provider we get a subject DN like:
"C=US,ST=California,O=example.com,CN=Ms. Barbara J Jensen III,E=bjensen@example.com"
This is obviously a problem.
Does anybody else ran into the same problem?
In my opinion it would be better to use:
cert.getSubjectX500Principal().getName(X500Principal.CANONICAL)
to determine the subject DN, as the result is provider independent.
But this would be an backward incompatible change in Method
org.keycloak.authentication.authenticators.x509.AbstractX509ClientCertificateAuthenticator.UserIdentityExtractorBuilder.fromConfig()