[ 
https://issues.apache.org/jira/browse/CXF-5118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14087612#comment-14087612
 ] 

Sergey Beryozkin commented on CXF-5118:
---------------------------------------

Hi Christian, 
See, the solution which works *only* with the possibly modified Karaf LDAP 
module is not a generic, CXF-level, solution. As such  a custom 3rd party CXF 
interceptor extending JAASLoginInterceptor can be added (with a tutorial 
created showing how this can be done). I'm not sure it makes sense to modify 
JAASLoginInterceptor itself if the only goal is to have it working in Karaf.

Lets target the case where we have a CXF webapp deployed into Tomcat and we 
want to use a Tomcat LDAP (or some other) JAAS module. Expecting all such 
modules be modified to accept password-less 'logins' in unrealistic. Therefore 
the CXF-level/generic solution should be flexible enough to work with JAAS 
modules which can not be modified.

You suggest passing a password along is a bad idea (security-wise). Possible. 
Likewise, IMHO having a module accepting  only a user name is not secure at all 
either :-), this module will accept login requests from the endpoints having no 
mutual authentication with bogus clients sending name + empty password pairs - 
this can be restricted but it is an obvious security hole IMHO. I think it is 
fair to say that both approached are not perfect but I feel that both can be 
made to be secure in a restricted environment.

Personally I'd seriously consider providing a password, perhaps I'd rely on a 
convention that if a password is say "_certificate_" it means the user has been 
authenticated via 2-way TLS. Or may it would have to be unique a generated 
number synced with the LDAP/etc database. Or may be some other more secure 
convention would be used. I do not know.

In the end of the day all that I'd like to happen is for us to come up with a 
generic solution :-) such that we can say, are you on Karaf, no problems, on 
Tomcat, well, it is tricky, but it will work too. You suggested to support 
passwords later on if needed, that is reasonable, but we'd freeze the mapper 
interface by then, it would only return String.
Hence I'm asking to update the response parameter type.

How about this 'compromise': the mapper would only return a bean called 
TLSLoginToken. It would have a single property only: "String username". If we 
have someone saying, well, I need a password too, then we'd add a new property 
to TLSLoginToken - this *would not break* the existing mapper implementations.

Does it sound reasonable ?    
   



> 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)

Reply via email to