challenge: how to login a user from a custom Tag?

Hey. The question is in the title.

This is the doEndTag() function inside a TagSupport implentation class :

publicint doEndTag(){

String j_username = pageContext.getRequest().getParameter("j_username");

String j_password = pageContext.getRequest().getParameter("j_password");

// HOW TO USE THESE 2 STRINGS FOR LOGING THE USER?

return EVAL_PAGE;

}

I can do basic authenticaton (I'm using tomcat btw), it's fine but I need to do this because the client is a Flash and not an html page. Any help is welcome, thanks!

[807 byte] By [bestama] at [2007-10-3 2:35:26]
# 1

maybe spit out some javascript which sets hidden variables j_username and j_password on the page and submits to /j_security_check?

The important thing is that the special URL /j_security_check is what handles the authentication, and that's handled by the Web Container. Unless you can exactly duplicate what the Web Container is doing in your custom tag, it's probably best to stick with the standard authentication, or roll your own.

Brian

brian@cubik.caa at 2007-7-14 19:34:22 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...