Skip to Content
avatar image
Former Member

create jsp for Custom login module(JAAS)

Hi all,

help me, how to call the custom login module from jsp page.

i want to send username, password to custom login module for authentication.

what is procedure and if u have code for jsp to calling that class . please post that.

iam waiting for reply.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Mar 26, 2009 at 03:52 PM

    You have two alternatives to do this:

    You can declare your JSP as a protected resource with the use of the deployment descriptors of the application (web.xml) and add the custom login module in the authentication stack of the application. This way, you will use container-based authentication, i.e. the Web Container will enforce the authentication and it will call the custom login module before it dispatches to the JSP. I recommend you this approach because it requires less coding and it makes the whole thing a matter of configuration. The configuration can be later on enhanced or changed runtime without the need to re-build and re-deploy the application. If you choose this approach you can go to the documentation of the server for help on how to modify the login module stack of the application.

    You can also use programmatic authentication by using JAAS API. To do this you need to create a custom security policy configuration with login module stack containing the custom login module, and then use the standard JAAS mechanism - new LoginContext(<configuration>, <callback-handler>).login(). This approach requires that you write your own callback handler and handle any LoginException.

    Let us know which approach you prefer and whether you have difficulties implementing it!

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hey, I'm interested in some documentation in the declarative approach to calling my LoginModule. I'm also having some trouble with getting everything working and understanding how it gets called.