Hi everyone.
So, I'm kicking off the thread for discussing the integration with Elytron.
As we have the new branch and the old branches, I decided we could move on to looking the new branch, that currently has no security code (correct me if I'm wrong, Stefano) after we have seen how to integrate branch 1.3.
The security in IronJacamar concerns two main parts, one is the Resource Principal related stuff, in short we need to apply a sequence of rules as defined by the spec to provide a secure access to the EIS, regardless of whether the application server is responsible for authenticating or the EIS itself.
Another important part is the Security Inflow, that I will discuss in another thread.
So, the Security Architecture is mainly defined in the Chapters 8 and 9 of the JCA spec:
https://java.net/downloads/connector-spec/connector-1_7-spec-final.pdfIn short, we have two scenarios when the component requests for a new connection:
- pass along security information if component-managed sign-on is enabled:
// perform JNDI lookup to obtain connection factory
javax.resource.cci.ConnectionFactory cxf = (javax.resource.cci.ConnectionFactory)initctx.lookup(“java:comp/env/eis/MyEIS”);
// Invoke factory to obtain a connection
com.myeis.ConnectionSpecImpl properties = .. // get a new ConnectionSpec
properties.setUserName(“...”);
properties.setPassword(“...”);
javax.resource.cci.Connection cx = cxf.getConnection(properties);
- use a series of rules to determine the resource principal and preform sign-on if container-managed sign-on is enabled
// Invoke factory to obtain a connection. The security
// information is not passed in the getConnection method
javax.resource.cci.Connection cx = cxf.getConnection();In this case, we have the possibility of having the resource princpal as a:
- configured identity: an identity configured to access the EIS
- mapped principal: the principal is defined as a mapping of the caller principal to the EIS
- impersonated caller principal: we are simply using the same caller principal and its credentials to access the EIS
- mapped crendentials: the principal is using a mapping of the credentials of the caller principal
The authorization could happen at the application server or at the EIS.
The resource principal is defined by the ConnectionManager, this is the sequence of calls that occurs after the component requests for a Connection:
ConnectionFactory.getConnection -> ConnectionManager.allocateConnection(ManagedConnectionFactory, ConnectionRequestInfo) -> ManagedConnectionFactory.createManagedConnection(Subject, ConnectionRequestInfo)
In the component-managed sign-on, the ConnectionFactory will just pass all data via the ConnectionRequestInfo, and IJ will pass that same data to the ManagedConnectionFactory, so there is nothing to do.
Elytron integration will be used for the second scenario, the container-managed sign-on. We need to create and provide the Subject to the ManagedConnectionFactory after ConnectionFactory is invoked.
There is also the scenario where ConnectionManager gets a connection already existent, but that doesn't affect us because in the end, we always end up in the getSubject method of AbstractionConnectionManager:
https://github.com/ironjacamar/ironjacamar/blob/1.3/core/src/main/java/org/jboss/jca/core/connectionmanager/AbstractConnectionManager.java#L1012That method uses a SecurityFactory, which is part of the spi. There is an implementation of that interface for PicketBox, so I'm thinking that, at a first moment, is just a matter of implementing that spi for Elytron.
Related classes:
https://github.com/ironjacamar/ironjacamar/blob/1.3/core/src/main/java/org/jboss/jca/core/spi/security/SubjectFactory.javahttps://github.com/ironjacamar/ironjacamar/blob/1.3/core/src/main/java/org/jboss/jca/core/security/DefaultSubjectFactory.javahttps://github.com/ironjacamar/ironjacamar/blob/1.3/core/src/main/java/org/jboss/jca/core/security/picketbox/PicketBoxSubjectFactory.java