I've never tried creating the cookie manually, but if you look in
SignupAction/Controller, you should see code that we use to programmatically
log the user in. That's the extent of my knowledge, if you want to do
something fancier, you might have to consult the Spring forums or dig into
the source code.

Matt

On Mon, Jun 23, 2008 at 4:12 AM, jithesh <[EMAIL PROTECTED]> wrote:

>
> Hello,
>
>             I tried creating the remember me cookie on a seperate jsp (not
> at login time). I created a class file and implemented the acegi service. I
> found that the cookie is generated during that call but gets deleted each
> time i click the application url. Because of that it again shows the login
> page.
>
>  I am posting the class which i implemented below. Correct me if anything
> went wrong
>
>
>
> ###############################################################################
>
> public void loginSuccess(HttpServletRequest request, HttpServletResponse
> response,
>                        Authentication authentication) {
>
>
>        /*      if(!rememberMeRequested(request, parameter)){
>
>                                if (logger.isDebugEnabled()) {
>                                        logger
>                                                        .debug("Did not send
> remember-me cookie (principal did not set
> parameter '"
>                                                                        +
> this.parameter + "')");
>                                }
>                                return;
>
>                }
>                */
>
>                Assert.notNull(authentication.getPrincipal());
>                Assert.notNull(authentication.getCredentials());
>                String username= null;
>                String password=null;
>                username = authentication.getPrincipal().toString();
>                password = authentication.getCredentials().toString();
>                Assert.hasLength(username);
>                Assert.hasLength(password);
>                String value = request.getParameter(parameter);
>
>
>        /*      if (StringUtils.hasText(value)) {
>                        try {
>                                tokenValiditySeconds =
> Long.parseLong(value.trim());
>                                if (tokenValiditySeconds < 0)
>                                        tokenValiditySeconds = 60 * 60 * 24
> * 365 * 5; // 5 years
>                        } catch (Exception e) {
>                        }
>                }*/
>
>
>                /*      try {
>                                tokenValiditySeconds =
> Long.parseLong(value.trim());
>                                if (tokenValiditySeconds < 0)
>                                        tokenValiditySeconds = 60 * 60 * 24
> * 365 * 5; // 5 years
>                        } catch (Exception e) {
>                        }
>        */
>
>                long expiryTime = System.currentTimeMillis()
>                + (tokenValiditySeconds * 1000);
>
>                String signatureValue = new
> String(DigestUtils.md5Hex(username + ":"
>                                + expiryTime + ":" + password + ":" + key));
>
>                String tokenValue = username + ":" + expiryTime + ":" +
> signatureValue;
>
>                String tokenValueBase64 = new
> String(Base64.encodeBase64(tokenValue.getBytes()));
>                response.addCookie(makeValidCookie(expiryTime,
> tokenValueBase64,
>                                request));
>
>
>        }
>
>
>    please give me some tips to solve the problem.
>
> thanks
> Jithesh
> --
> View this message in context:
> http://www.nabble.com/Acegi-Remember-me-tp14165954s2369p18066176.html
> Sent from the AppFuse - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to