I need to integrate IBM Security Access Manger with Tomcat 9 to authenticate users. I have a properly configured Webseal (junction) for the IBM SAM part. It takes the user's credentials, authenticates again the SAM server, and then if successful redirects to Tomcat while passing the headers iv-user
, iv-group
, and iv-creds
. I now need to write a custom Tomcat Valve to implement the authentication and allow access to apps based on the user's group. What would be the best way to go about doing this?
My current idea is to extend the org.apache.catalina.valves.AuthenticatorBase
so that I can use the following setup in the web.xml
of my application:
<security-constraint>
<web-resource-collection>
<web-resource-name>Application</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>POST</http-method>
<http-method>GET</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>MyRoleName</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
The headers from the Webseal can be parsed and used to generate a org.apache.catalina.realm.GenericPrincipal
and then used to authenticate into a role added to the given realm (or written into tomcat-users.xml
).
I'm a bit shaky onto how to actually implement this authentication, so any help no matter how basic would be much appreciated.