[
https://issues.apache.org/jira/browse/CXF-5118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14092136#comment-14092136
]
Christian Schneider commented on CXF-5118:
------------------------------------------
As far as I know there should always be a certificate when ssl is active.
I have just updated the code in my clone to include determining the name as
Sergey requested. I also added anonymous login as it is necessary to chain two
JAASLoginInterceptor like we discussed. Without this it would always break with
any exception. Anonymous login should be no security risk as it can be caught
with the LoginModule.
This is how the setup for two interceptors should work. I have not added a
special id handling for the Interceptor as I think the id should already be
different for two different instances. So this should work. I have not yet
fully tested this as I do not have a setup with a client cert. Does any of you
have a suitable setup for karaf or plain jetty / tomcat?
<cxf:bus id="personServiceBus">
<cxf:inInterceptors>
<!-- JAAS login based on TLS certificate subjectDN -->
<bean
class="org.apache.cxf.interceptor.security.JAASLoginInterceptor">
<property name="reportFault" value="true"/>
<property name="callbackHandlerProviders">
<list>
<ref bean="TLSCB"/>
</list>
</property>
</bean>
<!-- Default JAAS login interceptor working with basic auth or ws
security username token -->
<bean
class="org.apache.cxf.interceptor.security.JAASLoginInterceptor">
<property name="reportFault" value="true"/>
</bean>
</cxf:inInterceptors>
</cxf:bus>
Do you think this setup should be ok for users?
If all are fine with the current code I can do the commit on master and start
with an integration test. As I am on parental leave for some more time it will
take a bit though. So if any of you wants to step up to create a full test that
would be great. Btw. I already added a unit test to have some basic test
coverage.
> 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)