On 11/3/06, James Carman <[EMAIL PROTECTED]> wrote:
Maybe you could just create your own Tapestry form (just like you do
for any other page) and submit it.  Within the form's processing, you
could use the Acegi API
(SecurityContextHolder.getContext().setAuthentication() maybe?) to set
up the security context, authenticating however you want.  The
HttpSessionContextIntegrationFilter will take care of storing it in
the session for you so that each subsequent request will be
authenticated.  I should maybe look at integrating the "remember me"
stuff into the pipeline.  I could create a special module called
tapestry-acegi-rememberme or something so that you could just drop in
a jar to allow "remember me" services.

I came around to the same thing after looking at the Acegi basic auth
code. I'm doing something like this.

@InjectObject("service:hivemind.acegi.AuthenticationManager")
public abstract AuthenticationManager getAuthenticationManager();

public void doLogin()
{
 UsernamePasswordAuthenticationToken authRequest = new
UsernamePasswordAuthenticationToken( getEmail(), getPassword() );
 Authentication authResult;

 try {
   authResult = getAuthenticationMananger().authenticate( authRequest );
 } catch( AuthenticationException failed ) {
   SecurityContextHolder.getContext().setAuthentication( null );
   return;
 }

 SecurityContextHolder.getContext().setAuthentication( authResult );
}

The only think I have left is to figure out how to redirect back to
the original page where the user was at the time the authentication
was wanted. Is that saved somewhere or do I need to find out that for
my self?

--
       regards,
       Robin

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to