[
https://issues.apache.org/jira/browse/CXF-5118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14086130#comment-14086130
]
Piotr Klimczak commented on CXF-5118:
-------------------------------------
So one more shot.
Take a look:
https://github.com/PiotrKlimczak/cxf/commit/afc9ba020e7ab1e5c585e9db255f77b28e701c7f
It is not tested. Just to review is it good enough to spent more time on it.
So finally I have introduced only one new type: TLSJAASLoginInterceptor, that
is because:
1. I found CertificateMapper would cause configuration difficulties (especially
default implementation vs custom).
2. I do not like the fact that JAASLoginInterceptor is doing some certificate
stuff as it was not designed to do so
So...
The default behaviour is try to do password-less JAAS login.
We have 2 more use cases:
1. Reauthenticated with JAAS using user supplied password
1.1. Technical password same for all requests
1.2. Different password for each certificate
2. Let the user retrieve roles from somewhere without doing reauthentication at
all
*1.1* is easy, as with TLSJAASLoginInterceptor user can set "defaultPassword"
property on instance of TLSJAASLoginInterceptor (we can rename it to
defaultJAASPassword to be more descriptive)
*1.2* user have to extend TLSJAASLoginInterceptor with his own impl of one
method in TLSJAASLoginInterceptor, for example
{code}
protected AuthorizationPolicy mapCertificate(String username,
X509Certificate sendersCert) {
AuthorizationPolicy policy = super(username, sendersCert);
String somePasswordDifferentForEachKey =
whatever.getPasswordFor(policy.getUserName());
policy.setPassword(somePasswordDifferentForEachKey);
return policy;
}
{code}
*2.* with no 2nd auth needed is quite easy too, as all user have to do, is to
extend TLSJAASLoginInterceptor with his own impl of one method in
JAASLoginInterceptor, for example
{code}
protected LoginSecurityContext getSecurityContext(AuthorizationPolicy policy)
throws LoginException {
if (AUTHORIZATION_TYPE_TLS.equals(policy.getAuthenticationType())) {
return
getMyOwnSecurityContextForAlreadyAuthenticatedMessage(policy.getUserName());
} else {
return super.getSecurityContext(policy);
}
}
{code}
So still powerfull with less changes.
Constructive feedback please.
Thanks in advance!
> 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)