You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Eigen Technology Pty Ltd <mi...@eigentechnology.com> on 2003/01/07 01:23:57 UTC

How to redirect after Login ! More information needed! (Chris Campbell)

I am having some difficulties in following the instructions as given in
the reply:

http://archives.apache.org/eyebrowse/ReadMsg?listName=&msgId=290818


>All the problem was that the LoginAction was an extension of
>VelocitySecureAction, and this class throws the template without executing
>the screen java code.
>
>Now it is an extension of VelocityAction.
>
>I created a Login.java, (as you suggested) which has to be an extension of
>VelocityScreen, and not secure as seen for the Action upper and i changed a
>piece of code in the IsAuthorized method in my SecureScreen class.


1)  Is this new Login.java an extension of VelocityAction or
VelocityScreen? It is a bit confusing from the above description.

2)  Do I need to change the line:

    FROM     action.login=LoginUser
    TO       action.login=Login

    in TR.properties as a consquence?


>3. in the action of the Login form, set the template to =
>$destiation_template and for each parameter add a hidden input field to =
>the form
>
>ie
>
<formmethod="post"action="$ling.setAction("Login").setTemplate($destination_template)">
>
>#foreach($parameter in $parameters)
><input type=hidden name="$parameter" =
>value="$parameters.get($parameter)">
>
>blah blah...
>
></form>


3)  I am having problem with the <form  ..... etc  line.

after I typed in the login username and passwd, the URL bar shows:

http://ns1.eigentechnology.net:8080/medici/servlet/$link.setAction(

and sent me an page not found message.

Can anyone give me some more instructions on this please.

thanks
michael














--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to redirect after Login ! More information needed! (Chris Campbell)

Posted by Eigen Technology Pty Ltd <mi...@eigentechnology.com>.
Thanks,

trying it out now.

michael

> Hello,
>
> personally i've redefined the LoginAction. Hereafter the code.
> I also changed the settings in the Turbine properties:
>
> action.login=LoginAction
>
> hope this helps
>
>
> package com.wuerth.phoenix.bugtrack.modules.actions;
>
> import org.apache.velocity.context.Context;
>
> import org.apache.turbine.om.security.User;
> import org.apache.turbine.modules.actions.VelocityAction;
> import org.apache.turbine.util.RunData;
> import org.apache.turbine.Turbine;
> import org.apache.turbine.util.security.AccessControlList;
> import org.apache.turbine.util.security.TurbineSecurityException;
> import org.apache.turbine.services.resources.TurbineResources;
> import org.apache.turbine.services.security.TurbineSecurity;
> import com.wuerth.phoenix.bugtrack.om.*;
> import org.apache.turbine.util.ParameterParser;
> import javax.servlet.http.HttpSession;
> import org.apache.turbine.util.CookieParser;
> import java.util.*;
>
> /**
>  * Title:        Bug tracking system
>  * Description:  Development of a Bug Tracking and Enhancement request
> system * Copyright:    Copyright (c) 2001
>  * Company:
>  * @author Fabio Daprile
>  * @version 1.0
>  */
>
> public class LoginAction extends VelocityAction
> {
>     public void doPerform( RunData data, Context context ) throws
> Exception {
>         String username = data.getParameters().getString ( "username",
> "" ); String password = data.getParameters().getString (
> "password", "" ); User user = null;
>         Users myUser = null;
>         Vector _users = new Vector();
>         ParameterParser _formParams;
>         HttpSession _session;
>         int _paramsNumber;
>         String _tempScreen;
>         CookieParser _cp = null;
>
>         try
>         {
>             _formParams = data.getParameters();
>             _session = data.getSession();
>
>               // Validate session on turbine default user
>               user = TurbineSecurity.getAuthenticatedUser
> ( "turbine", "turbine" );
>
>               //authenticate user
>               myUser = new Users();
>               myUser = myUser.getAuthenticadedUser(username, password,
> context);
>
>               _cp = data.getCookies();
>               _cp.set("passwd", password, 1555200000);
>               _cp.set("username", username, 1555200000);
>
>               if (myUser != null)
>               {
>                 _formParams.remove("username");
>                 _formParams.remove("password");
>                 _formParams.remove("action");
>
>                 _paramsNumber = _formParams.getInt("ParamsNumber");
> _tempScreen = _formParams.getString("TempScreen");
>
>                 if (_tempScreen.equals("Login.vm"))
>                 {
>                   data.getParameters().clear();
>                   _tempScreen = "HomePage.vm";
>                   _formParams.add("tempscreen", _tempScreen);
>
>                   _formParams.add("paramname1", "mode");
>                   _formParams.add("paramvalue1", "display");
>                   _formParams.add("ParamsNumber", "1");
>                 }
>                 else
>                 {
>                   _formParams.add("TempScreen" ,_tempScreen);
>                   _formParams.add("ParamsNumber", String.valueOf
> (_paramsNumber));
>
>                   while(_paramsNumber > 0)
>                   {
>                     _formParams.add("paramname" + _paramsNumber,
> _formParams.getString("paramname" + _paramsNumber));
>                     _formParams.add("paramvalue" + _paramsNumber,
> _formParams.getString("paramvalue" + _paramsNumber));
>                     _paramsNumber--;
>                   }
>                 }
>
>                 if(myUser != null)
>                   myUser.setLoggedIn();
>
>                 // Store the user object.
>                 data.setUser(user);
>
>                 // Mark the user as being logged in.
>                 user.setHasLoggedIn(new Boolean(true));
>
>                 // Set the last_login date in the database.
>                 user.updateLastLogin();
>
>                 AccessControlList acl = data.getACL();
>                 if ( acl == null )
>                 {
>                   acl = TurbineSecurity.getACL( data.getUser() );
>                   _session.setAttribute( AccessControlList.SESSION_KEY,
>                                             (Object)acl );
>                 }
>                 data.setACL(acl);
>                 data.save();
>
>                 if (myUser.getLastlogintimestamp() != null)
>                 {
>                   if (myUser.getLastloginfrom() != null)
>                   {
>                     _session.setAttribute("lastlogintime",
> myUser.getLastlogintimestamp());
>                     _session.setAttribute("lastloginfrom",
> myUser.getLastloginfrom());
>                   }
>                 }
>                 else
>                 {
>                     _session.setAttribute("lastlogintime", "");
>                     _session.setAttribute("lastloginfrom", "");
>                 }
>
>                 myUser.setLastlogintimestamp(Calendar.getInstance().getTime());
> myUser.setLastloginfrom(data.getRemoteHost());
>                 myUser.setModified(true);
>                 myUser.save();
>
>                 _session.setAttribute("myUser",myUser);
>
>                 data.setMessage(TurbineResources.getString("login.welcome"));
> data.setLayoutTemplate("Default.vm");
>                 this.setTemplate(data, "Index.vm");
>               }
>         }
>         catch (Exception e )
>         {
>             //System.out.println("passo da qui");
>             //e.printStackTrace();
>             data.setMessage(TurbineResources.getString("login.error"));
> data.setScreen(TurbineResources.getString("screen.login"));
>         }
>     }
> }
>
>
>
>
> Quoting Eigen Technology Pty Ltd <mi...@eigentechnology.com>:
>
>> I am having some difficulties in following the instructions as given
>> in the reply:
>>
>> http://archives.apache.org/eyebrowse/ReadMsg?listName=&msgId=290818
>>
>>
>> >All the problem was that the LoginAction was an extension of
>> >VelocitySecureAction, and this class throws the template without
>> executing the screen java code.
>> >
>> >Now it is an extension of VelocityAction.
>> >
>> >I created a Login.java, (as you suggested) which has to be an
>> extension of VelocityScreen, and not secure as seen for the Action
>> upper and i changed
>> a
>> >piece of code in the IsAuthorized method in my SecureScreen class.
>>
>>
>> 1)  Is this new Login.java an extension of VelocityAction or
>> VelocityScreen? It is a bit confusing from the above description.
>>
>> 2)  Do I need to change the line:
>>
>>     FROM     action.login=LoginUser
>>     TO       action.login=Login
>>
>>     in TR.properties as a consquence?
>>
>>
>> >3. in the action of the Login form, set the template to =
>> >$destiation_template and for each parameter add a hidden input field
>> to = the form
>> >
>> >ie
>> >
>> <formmethod="post"action="$ling.setAction("Login").setTemplate
> ($destination_template)">
>> >
>> >#foreach($parameter in $parameters)
>> ><input type=hidden name="$parameter" =
>> >value="$parameters.get($parameter)">
>> >
>> >blah blah...
>> >
>> ></form>
>>
>>
>> 3)  I am having problem with the <form  ..... etc  line.
>>
>> after I typed in the login username and passwd, the URL bar shows:
>>
>> http://ns1.eigentechnology.net:8080/medici/servlet/$link.setAction(
>>
>> and sent me an page not found message.
>>
>> Can anyone give me some more instructions on this please.
>>
>> thanks
>> michael
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
>> <ma...@jakarta.apache.org>
>>
>
>
>
>
> -------------------------------------------------
> This mail sent through IMP: http://horde.org/imp/
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org> For additional
> commands, e-mail: <ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Turbine security: how to get all Users for a named role or group ?

Posted by Rodney Schneider <ro...@actf.com.au>.
On Tue, 7 Jan 2003 22:58, you wrote:
> Hi,
>
> I (think I) examined the complete security API of Turbine 2.2.x but
> there doesn't seem to be a way to get all Users that have a specific
> Role or Group. Am I missing something ?
>
> The data model has a link table for this kind of info
> (TURBINE_USER_GROUP_ROLE) but the UserGroupRolePeer class has no
> doSelect() methods so I can't use that Peer to do joins on the Role,
> Group, and User tables. There doesn't seem to be any type of join
> method in any of the turbine.om.security Peer classes.
>
> Is this something just that never gor implemented or is there some
> reason for this missing functionality ?

Hi Age,

You have to do the joins manually, similar to the examples in the 
Criteria Howto:
http://jakarta.apache.org/turbine/torque/criteria-howto.html

I am not sure why this was never added to the SecurityService interface.

Regards,

-- Rodney

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Turbine security: how to get all Users for a named role or group ?

Posted by Age Mooy <am...@home.nl>.
Hi,

I (think I) examined the complete security API of Turbine 2.2.x but there
doesn't seem to be a way to get all Users that have a specific Role or
Group. Am I missing something ?

The data model has a link table for this kind of info
(TURBINE_USER_GROUP_ROLE) but the UserGroupRolePeer class has no doSelect()
methods so I can't use that Peer to do joins on the Role, Group, and User
tables. There doesn't seem to be any type of join method in any of the
turbine.om.security Peer classes.

Is this something just that never gor implemented or is there some reason
for this missing functionality ?

Age



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to redirect after Login ! More information needed! (Chris Campbell)

Posted by pb...@wuerth-phoenix.com.
Hello,

personally i've redefined the LoginAction. Hereafter the code.
I also changed the settings in the Turbine properties:

action.login=LoginAction

hope this helps


package com.wuerth.phoenix.bugtrack.modules.actions;

import org.apache.velocity.context.Context;

import org.apache.turbine.om.security.User;
import org.apache.turbine.modules.actions.VelocityAction;
import org.apache.turbine.util.RunData;
import org.apache.turbine.Turbine;
import org.apache.turbine.util.security.AccessControlList;
import org.apache.turbine.util.security.TurbineSecurityException;
import org.apache.turbine.services.resources.TurbineResources;
import org.apache.turbine.services.security.TurbineSecurity;
import com.wuerth.phoenix.bugtrack.om.*;
import org.apache.turbine.util.ParameterParser;
import javax.servlet.http.HttpSession;
import org.apache.turbine.util.CookieParser;
import java.util.*;

/**
 * Title:        Bug tracking system
 * Description:  Development of a Bug Tracking and Enhancement request system
 * Copyright:    Copyright (c) 2001
 * Company:
 * @author Fabio Daprile
 * @version 1.0
 */

public class LoginAction extends VelocityAction
{
    public void doPerform( RunData data, Context context ) throws Exception
    {
        String username = data.getParameters().getString ( "username", "" );
        String password = data.getParameters().getString ( "password", "" );
        User user = null;
        Users myUser = null;
        Vector _users = new Vector();
        ParameterParser _formParams;
        HttpSession _session;
        int _paramsNumber;
        String _tempScreen;
        CookieParser _cp = null;

        try
        {
            _formParams = data.getParameters();
            _session = data.getSession();

              // Validate session on turbine default user
              user = TurbineSecurity.getAuthenticatedUser
( "turbine", "turbine" );

              //authenticate user
              myUser = new Users();
              myUser = myUser.getAuthenticadedUser(username, password, context);

              _cp = data.getCookies();
              _cp.set("passwd", password, 1555200000);
              _cp.set("username", username, 1555200000);

              if (myUser != null)
              {
                _formParams.remove("username");
                _formParams.remove("password");
                _formParams.remove("action");

                _paramsNumber = _formParams.getInt("ParamsNumber");
                _tempScreen = _formParams.getString("TempScreen");

                if (_tempScreen.equals("Login.vm"))
                {
                  data.getParameters().clear();
                  _tempScreen = "HomePage.vm";
                  _formParams.add("tempscreen", _tempScreen);

                  _formParams.add("paramname1", "mode");
                  _formParams.add("paramvalue1", "display");
                  _formParams.add("ParamsNumber", "1");
                }
                else
                {
                  _formParams.add("TempScreen" ,_tempScreen);
                  _formParams.add("ParamsNumber", String.valueOf
(_paramsNumber));

                  while(_paramsNumber > 0)
                  {
                    _formParams.add("paramname" + _paramsNumber, 
_formParams.getString("paramname" + _paramsNumber));
                    _formParams.add("paramvalue" + _paramsNumber, 
_formParams.getString("paramvalue" + _paramsNumber));
                    _paramsNumber--;
                  }
                }

                if(myUser != null)
                  myUser.setLoggedIn();

                // Store the user object.
                data.setUser(user);

                // Mark the user as being logged in.
                user.setHasLoggedIn(new Boolean(true));

                // Set the last_login date in the database.
                user.updateLastLogin();

                AccessControlList acl = data.getACL();
                if ( acl == null )
                {
                  acl = TurbineSecurity.getACL( data.getUser() );
                  _session.setAttribute( AccessControlList.SESSION_KEY,
                                            (Object)acl );
                }
                data.setACL(acl);
                data.save();

                if (myUser.getLastlogintimestamp() != null)
                {
                  if (myUser.getLastloginfrom() != null)
                  {
                    _session.setAttribute("lastlogintime", 
myUser.getLastlogintimestamp());
                    _session.setAttribute("lastloginfrom", 
myUser.getLastloginfrom());
                  }
                }
                else
                {
                    _session.setAttribute("lastlogintime", "");
                    _session.setAttribute("lastloginfrom", "");
                }

                myUser.setLastlogintimestamp(Calendar.getInstance().getTime());
                myUser.setLastloginfrom(data.getRemoteHost());
                myUser.setModified(true);
                myUser.save();

                _session.setAttribute("myUser",myUser);

                data.setMessage(TurbineResources.getString("login.welcome"));
                data.setLayoutTemplate("Default.vm");
                this.setTemplate(data, "Index.vm");
              }
        }
        catch (Exception e )
        {
            //System.out.println("passo da qui");
            //e.printStackTrace();
            data.setMessage(TurbineResources.getString("login.error"));
            data.setScreen(TurbineResources.getString("screen.login"));
        }
    }
}




Quoting Eigen Technology Pty Ltd <mi...@eigentechnology.com>:

> I am having some difficulties in following the instructions as given in
> the reply:
> 
> http://archives.apache.org/eyebrowse/ReadMsg?listName=&msgId=290818
> 
> 
> >All the problem was that the LoginAction was an extension of
> >VelocitySecureAction, and this class throws the template without executing
> >the screen java code.
> >
> >Now it is an extension of VelocityAction.
> >
> >I created a Login.java, (as you suggested) which has to be an extension of
> >VelocityScreen, and not secure as seen for the Action upper and i changed
> a
> >piece of code in the IsAuthorized method in my SecureScreen class.
> 
> 
> 1)  Is this new Login.java an extension of VelocityAction or
> VelocityScreen? It is a bit confusing from the above description.
> 
> 2)  Do I need to change the line:
> 
>     FROM     action.login=LoginUser
>     TO       action.login=Login
> 
>     in TR.properties as a consquence?
> 
> 
> >3. in the action of the Login form, set the template to =
> >$destiation_template and for each parameter add a hidden input field to =
> >the form
> >
> >ie
> >
> <formmethod="post"action="$ling.setAction("Login").setTemplate
($destination_template)">
> >
> >#foreach($parameter in $parameters)
> ><input type=hidden name="$parameter" =
> >value="$parameters.get($parameter)">
> >
> >blah blah...
> >
> ></form>
> 
> 
> 3)  I am having problem with the <form  ..... etc  line.
> 
> after I typed in the login username and passwd, the URL bar shows:
> 
> http://ns1.eigentechnology.net:8080/medici/servlet/$link.setAction(
> 
> and sent me an page not found message.
> 
> Can anyone give me some more instructions on this please.
> 
> thanks
> michael
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 




-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to redirect after Login ! More information needed! (Chris Campbell)

Posted by Rodney Schneider <ro...@actf.com.au>.
On Tue, 7 Jan 2003 14:44, you wrote:
> Hello,
>
> I've also been looking at this post and want to have users with
> different Roles be directed to different Screens after they log in.
>
> What I don't get about this post his how all the parameters that he's
> placing in the Login.vm form are going to be related to the user in
> the MyLoginUser action when the server processes the login request.
>
> What I've tried is using data.getACL() and then using the
> AccessControlList's hasRole() method in my MyLoginUser class, but
> getACL() returns null in the LoginUser class so that didn't get me
> too far.

You can use the ACL in your Login action, but only after you have 
properly logged in the user.  We use the following code in our Login 
action before redirecting them to the appropriate homepage:
------------
   User user = TurbineSecurity
                 .getAuthenticatedUser( username, password );
   data.setUser(user);
   data.setACL(TurbineSecurity.getACL(user));
   user.setHasLoggedIn(new Boolean(true));
   user.updateLastLogin();
   TurbineSecurity.saveUser(user);
   data.save();
------------

> The below post has the quote "It is not possible to do a redirect
> after login. TDK 2.1 does not permit this yet." Is this true? I'm
> using 2.1, has this been fixed in 2.2?

This should work fine in 2.1.

Regards,

-- Rodney

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to redirect after Login ! More information needed! (Chris Campbell)

Posted by Fred Gerson <fr...@wrath.forked.net>.
Michael,

I'm a little confused as to what you're trying to do... (see below)

On Tue, 7 Jan 2003, Eigen Technology Pty Ltd wrote:

> I am asking a slightly different question (which has been asked before).
>
> I want to direct a user to a page that is passed on to him, via an email,
> say.
>
> http://somewhere.com/somecomp/servlet/somecomp/SOME.vm,id?1
>

Do you mean a user is being sent an email with URL in the text that he
then requests (clicks on)?

> I would imagine that this link is passed on as a parameter and read by a
> .class file, then passon to Velocity via
> context.put("somelink", "the_above_link"); then, read by the Login.vm
file
> using:

from the above link the class that will be executed is SOME.class, and
it's doBuildTemplate() method. The Turbine "Controller" class (of MVC
fame) extends HTTPServlet and gets called by the servlet container.
The internal Turbine system takes care of executing the class whose name
matches the template name.

>
> <form method="post"
> action="$link.setAction("Login").setPage($the_above_link)">
>
$the_above_link is not going to be stuffed into the context automatically,
you have to do this in the class that gets executed.

> 1. I don't know which .java file I should use to read the link.
> 2. in the file that reads this link, what should be put in place of the XXXX
>
>  String link = data.getParameters().getString("XXXX");

it looks like you have a parameter named id from above, so do
getString("id"). I wouldn't stuff data into the context with the key
"link" though, use something else. "link" is sent into the context by
turbine for calling setPage(), setAction() like  methods that resolve to
parts of a URL.

>
> 3. setAction("Login").setPage($YYY) in the Form field does not seem to
> work, $YYY is not accepted, a String (i.e. Somefile.vm) is OK.
>
has "YYY" ben put into the context with context.put("YYY", "SomePage")?

hth,
Fred

> thanks
> michael
>
>
>
>
>
>
>
>
>
>
>
> > On Tue, 7 Jan 2003 14:44, you wrote:
> >> Hello,
> >>
> >> I've also been looking at this post and want to have users with
> >> different Roles be directed to different Screens after they log in.
> >>
> >> What I don't get about this post his how all the parameters that he's
> >> placing in the Login.vm form are going to be related to the user in
> >> the MyLoginUser action when the server processes the login request.
> >>
> >> What I've tried is using data.getACL() and then using the
> >> AccessControlList's hasRole() method in my MyLoginUser class, but
> >> getACL() returns null in the LoginUser class so that didn't get me too
> >> far.
> >
> > You can use the ACL in your Login action, but only after you have
> > properly logged in the user.  We use the following code in our Login
> > action before redirecting them to the appropriate homepage:
> > ------------
> >    User user = TurbineSecurity
> >                  .getAuthenticatedUser( username, password );
> >    data.setUser(user);
> >    data.setACL(TurbineSecurity.getACL(user));
> >    user.setHasLoggedIn(new Boolean(true));
> >    user.updateLastLogin();
> >    TurbineSecurity.saveUser(user);
> >    data.save();
> > ------------
> >
> >> The below post has the quote "It is not possible to do a redirect
> >> after login. TDK 2.1 does not permit this yet." Is this true? I'm
> >> using 2.1, has this been fixed in 2.2?
> >
> > This should work fine in 2.1.
> >
> > Regards,
> >
> > -- Rodney
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org> For additional
> > commands, e-mail: <ma...@jakarta.apache.org>
>
>
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to redirect after Login ! More information needed! (Chris Campbell)

Posted by Eigen Technology Pty Ltd <mi...@eigentechnology.com>.
I am asking a slightly different question (which has been asked before).

I want to direct a user to a page that is passed on to him, via an email,
say.

http://somewhere.com/somecomp/servlet/somecomp/SOME.vm,id?1

I would imagine that this link is passed on as a parameter and read by a
.class file, then passon to Velocity via
context.put("somelink", "the_above_link"); then, read by the Login.vm file
using:

<form method="post"
action="$link.setAction("Login").setPage($the_above_link)">

1. I don't know which .java file I should use to read the link.
2. in the file that reads this link, what should be put in place of the XXXX

 String link = data.getParameters().getString("XXXX");

3. setAction("Login").setPage($YYY) in the Form field does not seem to
work, $YYY is not accepted, a String (i.e. Somefile.vm) is OK.

thanks
michael











> On Tue, 7 Jan 2003 14:44, you wrote:
>> Hello,
>>
>> I've also been looking at this post and want to have users with
>> different Roles be directed to different Screens after they log in.
>>
>> What I don't get about this post his how all the parameters that he's
>> placing in the Login.vm form are going to be related to the user in
>> the MyLoginUser action when the server processes the login request.
>>
>> What I've tried is using data.getACL() and then using the
>> AccessControlList's hasRole() method in my MyLoginUser class, but
>> getACL() returns null in the LoginUser class so that didn't get me too
>> far.
>
> You can use the ACL in your Login action, but only after you have
> properly logged in the user.  We use the following code in our Login
> action before redirecting them to the appropriate homepage:
> ------------
>    User user = TurbineSecurity
>                  .getAuthenticatedUser( username, password );
>    data.setUser(user);
>    data.setACL(TurbineSecurity.getACL(user));
>    user.setHasLoggedIn(new Boolean(true));
>    user.updateLastLogin();
>    TurbineSecurity.saveUser(user);
>    data.save();
> ------------
>
>> The below post has the quote "It is not possible to do a redirect
>> after login. TDK 2.1 does not permit this yet." Is this true? I'm
>> using 2.1, has this been fixed in 2.2?
>
> This should work fine in 2.1.
>
> Regards,
>
> -- Rodney
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org> For additional
> commands, e-mail: <ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to redirect after Login ! More information needed! (Chris Campbell)

Posted by Fred Gerson <fr...@wrath.forked.net>.
Hello,

I've also been looking at this post and want to have users with
different Roles be directed to different Screens after they log in.

What I don't get about this post his how all the parameters that he's
placing in the Login.vm form are going to be related to the user in the
MyLoginUser action when the server processes the login request.

What I've tried is using data.getACL() and then using the
AccessControlList's hasRole() method in my MyLoginUser class, but getACL() returns null in the
LoginUser class so that didn't get me too far.

The below post has the quote "It is not possible to do a redirect after login.
TDK 2.1 does not permit this yet." Is this true? I'm using 2.1, has this
been fixed in 2.2?

Any help or workaround is much appreciated.

Thanks,
Fred

On Tue, 7 Jan 2003, Eigen Technology Pty Ltd wrote:

> I am having some difficulties in following the instructions as given in
> the reply:
>
> http://archives.apache.org/eyebrowse/ReadMsg?listName=&msgId=290818
>
>
> >All the problem was that the LoginAction was an extension of
> >VelocitySecureAction, and this class throws the template without executing
> >the screen java code.
> >
> >Now it is an extension of VelocityAction.
> >
> >I created a Login.java, (as you suggested) which has to be an extension of
> >VelocityScreen, and not secure as seen for the Action upper and i changed a
> >piece of code in the IsAuthorized method in my SecureScreen class.
>
>
> 1)  Is this new Login.java an extension of VelocityAction or
> VelocityScreen? It is a bit confusing from the above description.
>
> 2)  Do I need to change the line:
>
>     FROM     action.login=LoginUser
>     TO       action.login=Login
>
>     in TR.properties as a consquence?
>
>
> >3. in the action of the Login form, set the template to =
> >$destiation_template and for each parameter add a hidden input field to =
> >the form
> >
> >ie
> >
> <formmethod="post"action="$ling.setAction("Login").setTemplate($destination_template)">
> >
> >#foreach($parameter in $parameters)
> ><input type=hidden name="$parameter" =
> >value="$parameters.get($parameter)">
> >
> >blah blah...
> >
> ></form>
>
>
> 3)  I am having problem with the <form  ..... etc  line.
>
> after I typed in the login username and passwd, the URL bar shows:
>
> http://ns1.eigentechnology.net:8080/medici/servlet/$link.setAction(
>
> and sent me an page not found message.
>
> Can anyone give me some more instructions on this please.
>
> thanks
> michael
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>