[
https://issues.apache.org/jira/browse/CXF-5118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14089177#comment-14089177
]
Christian Schneider commented on CXF-5118:
------------------------------------------
I think you guys are right that we need the ability to use a password for the
LoginModule. We may be able to change the LoginModules in karaf but outside of
karaf we have to live with what is provided. Sergeys idea of using a bean is a
possible solution. I have implemented an alternative solution by using a
separate interface to just map username to password.
I think this might be better as the mapping from cert to name and name to
password might be quite different. For example like Sergey described you might
have the same password for all technical user. So I made sure this case is
especially simple.
Piotr also correctly stated that using no password by default might be a
security problem. So I implemented the CallbackHandlerProvider I originally
wanted to do in separate issue. Now we have three CallBackHandlerProviders one
for AuthorizationPolicy, one for UsernameToken and one for TLS cert handling.
So by default the first two are active and the user can create a list of
providers like he wants to set it up. So the user is in fully control over what
is going to the LoginModules. He even can define additional
CallbackHandlerProviders for other authentication schemes. This way we can also
add more handlers like e.g. for cert based auth on the ws security level or for
STS token based auth.
I think this solution is more in line of how JAAS works than the current
solution from Piotr. Still I think we could even handle the situation that
Priotr supports where we do no real authentication. It would work by creating a
new LoginModule that simply creates the subject from prinicpal and role data.
I used a lot of code from the original solution of Piotr but did a slightly
different design. I hope you both like it.
https://github.com/cschneider/cxf/commit/bc436011e99084b5e2f1165b70aa4cf028a49a1a
This commit is just the changes compared to my first commit. To see the full
solution please look into the sources directly.
> 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)