You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by TNO <tn...@free.fr> on 2013/09/15 15:39:55 UTC

[T5.3] Authentification by url with tapestry-spring-security

Hi,

I'm trying to identicate automatically an user with a string token in an 
url.

Example : www.toto.fr/mypage/mytoken

I'm trying to do this using the setupRender of myPage by doing this :

     public void setContext(String tokenKey) {
         UserDetails ud = loadUserByUsername(tokenKey);

         UsernamePasswordAuthenticationToken result = new 
UsernamePasswordAuthenticationToken (
             ud,
             null,
             ud.getAuthorities());

         SecurityContextImpl sc = new SecurityContextImpl();
         sc.setAuthentication(result);

         SecurityContextHolder.clearContext();
         SecurityContextHolder.setContext(sc);
     }

It seems to not works properly.

Did someone already try to do this ?
Is this the good way ?

Thanks for any help, Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org