We currently use the legacy security subsystem with this security-domain:
<security-domain name="mbisso" cache-type="default">
<authentication>
<login-module code="biz.mbisoftware.common.sso.MbiSingleSignOnLoginModule" flag="optional">
<module-option name="password-stacking" value="useFirstPass"/>
</login-module>
<login-module code="DatabaseUsers" flag="required">
<module-option name="password-stacking" value="useFirstPass"/>
<module-option name="dsJndiName" value="java:jboss/datasources/DefaultDS"/>
<module-option name="principalsQuery" value="SELECT password FROM mbi_juser WHERE username=? AND is_activ=1"/>
<module-option name="rolesQuery" value="SELECT role, role_group FROM mbi_jrole WHERE username=?"/>
<module-option name="hashAlgorithm" value="MD5"/>
<module-option name="hashEncoding" value="base64"/>
</login-module>
</authentication>
</security-domain>
The first custom login-module is used for authentication only, and only can be successful if our web application was called from our desktop application.
In this case parameters are added to the URL containing the username and client information. The login module then tries to connect the desktop client with this given information. In case of success the user is logged in.
In this case, the second database login module does only the authorization, retrieving the roles assigned to this user. The password check is not done anymore.
In case of standalone opening the web-app, the first login module does no succeed and authentication and authorization are handled by the database login module.
How to do the same with Elytron now ?
The database login module is migrated successfully.
The authentication seems to work, but database based login module is not called for authorization.
From standalone-full.xml / elytron subsystem:
<security-domain name="mbisso" default-realm="mbisso-proc" permission-mapper="default-permission-mapper">
<realm name="mbisso-proc" role-decoder="from-roles-attribute"/>
<realm name="mbisso-jdbc" role-decoder="from-roles-attribute"/>
</security-domain>
<custom-realm name="mbisso-proc" module="biz.mbisoftware.common.sso.custom-realm" class-name="biz.mbisoftware.common.sso.MbiSingleSignOnRealm3"/>
<jdbc-realm name="mbisso-jdbc">
<principal-query sql="SELECT password FROM mbi_juser WHERE username = ? AND is_activ = 1" data-source="DefaultDS">
<simple-digest-mapper password-index="1"/>
</principal-query>
<principal-query sql="SELECT role FROM mbi_jrole WHERE username = ?" data-source="DefaultDS">
<attribute-mapping>
<attribute to="roles" index="1"/>
</attribute-mapping>
</principal-query>
</jdbc-realm>
I also tried
<aggregate-realm name="mbisso" authentication-realm="mbisso-proc" authorization-realm="mbisso-jdbc"/>
but without success.