[ https://issues.apache.org/jira/browse/CXF-5118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14089311#comment-14089311 ]
Steve Storck commented on CXF-5118: ----------------------------------- I'll document my situation in order to help the developers with possible scenarios where people need certificate authentication. We're using Jetty and Karaf. In jetty.xml, we add beans to instantiate JAASLoginServices. We have a realm that uses two login modules: org.apache.karaf.jaas.modules.ldap.LDAPLoginModule, and a custom version of that where we want to use the certificate in the request to authenticate the user via the DN in the certificate. In our blueprint.xml file when we are defining our jaxrs providers, we define a CrossOriginResourceSharingFilter, and so we have a CORS-enabled JAASAuthenticationFilter extension. This filter is using org.apache.cxf.interceptor.security.NamePasswordCallbackHandler. As a slightly-related aside (though relating somewhat to Christian's comment about implementing handlers), it is my understanding that CallbackHandler implementations were required to have a no-argument constructor, but this cxf class can only be instantiated by accepting username and password arguments. So this presents a problem when you are using a filter and when you need CallbackHandler instances that can perform multi module authentication. We want to try the cert first, then fall back to username/password authentication to our LDAP server. I hope this information/use case is at least somewhat helpful, and let me know if I can further clarify anything. I cannot post source code because our development occurs on a proprietary network. > Create CXF interceptor which will use HTTPS client certificates to create > JAAS SecurityContext > ----------------------------------------------------------------------------------------------- > > Key: CXF-5118 > URL: https://issues.apache.org/jira/browse/CXF-5118 > Project: CXF > Issue Type: New Feature > Components: Core > Reporter: Sergey Beryozkin > Assignee: Christian Schneider > > Use case: > The user authenticates against the webservice using an X509 client > certificate. In case of successful authentication the JAAS security context > should be populated with a Subject that stores the user name and the roles of > the user. This is necessary to support Authorization at a later stage. > Design ideas > The SSL transport will be configured to only accept certain client > certificates. So we can assume that the interceptor does not have to do a > real authentication. Instead it has to map from the subjectDN of the > certificate to the user name and then lookup the roles of that user. Both > then has to be stored in the subject's principles. > The mapping could be done inside a JAASLoginModule or before. Inside will > give the user more flexibility. > The next step to retrieve the roles should be done in one of the standard > JAASLoginModules as the source of the roles can be quite diverse. So for > example the LdapLoginModule allows to retrieve the roles from Ldap. At the > moment these modules require the password of the user though which is not > available when doing a cert based auth. > So I see two variants to retrieve the roles: > 1. Change the loginmodules like the LDAP one to be configureable to use a > fixed ldap user for the ldap connect and not require the user password. So > the module would have two modes: a) normal authentication and group gathering > b) use a fixed user to just retrieve roles for a given user > 2. Store the user password somewhere (e.g. in the mapping file). In this case > the existing LDAPLoginModule could be used but the user password would be > openly in a text file > 3. Create new LoginModules with the desired behaviour (fixed user and only > lookup of roles) -- This message was sent by Atlassian JIRA (v6.2#6252)