JAAS: Make application use Tomcat authentication settings -


is possible make web application uses jaas authenticate via tomcats default authentication method.

to illustrate: tomcat uses tomcat_users.xml authentications. web application has defined own method in jaas.cfg. how configure jaas.cfg in such way uses tomcat's method in when configuration in tomcat changes application's authentication method switches aswell.

current config looks this:

bonitaauth {    org.ow2.bonita.identity.auth.bonitaidentityloginmodule required;  };    bonitastore {    org.ow2.bonita.identity.auth.localstorageloginmodule required;  };    bonitaauth-default {    org.ow2.bonita.identity.auth.bonitaidentityloginmodule required domain="default";    org.ow2.bonita.identity.auth.localstorageloginmodule required domain="default";  };    bonitastore-default {    org.ow2.bonita.identity.auth.localstorageloginmodule required domain="default";  };    /**   * used rest server   */  bonitarestserver {    org.ow2.bonita.identity.auth.bonitarestserverloginmodule required logins="restuser" passwords="restbpm" roles="restuser";  }; 

the tomcat user repository defined tomcat realms. tomcat_users.xml file used memoryrealm. use jaas configuration (jaas.cfg) configure jaasrealm: http://tomcat.apache.org/tomcat-7.0-doc/realm-howto.html#jaasrealm

it possible use java ee authentication , implement own realm. have 3 options:

  1. implement tomcat realm interface http://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/realm.html
  2. extend realmbase http://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/realm/realmbase.html)
  3. extend jaasrealm http://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/realm/jaasrealm.html

configure own realm in server.xml

<realm classname="org.myrealm"/> 

tomcat call authenticate method http://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/realm/realmbase.html#authenticate%28java.lang.string,%20java.lang.string%29

in method can call jaas authentication.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -