You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by tubin gen <fa...@gmail.com> on 2009/12/11 22:58:35 UTC

login with a parameter, no form

My application does not authenticate user ,some external application
authenticates and redirects to my application passing a parameter to
identify the user, using this parameter I have to create a session and
userdetails.

I am using SimplePageAuthrizationStrategy


        getSecuritySettings().setAuthorizationStrategy(new
SimplePageAuthorizationStrategy(BasePage.class,getSignInPageClass()){
            @Override
            protected boolean isAuthorized() {
                return ((AuditWebSession)Session.get()).isSignedIn();
                //return true;
            }
        });


here my SignInPage

public class SSIIntegrationLogin extends WebPage {

    private String sessionId;

    public SSIIntegrationLogin(PageParameters  pageParameters) {

sessionId=getRequestCycle().getRequest().getParameter(Parameters.PARAM_SSI_SESSION_ID);
        if (signIn(sessionId)){
            onSignInSucceeded();
        }else{
            onSignInFailed();
        }
    }

    protected void onSignInFailed()
    {
        setRedirect(true);
        setResponsePage(SingInFailedPage.class);
    }


    public boolean signIn(String sessionId)
    {
        return AuthenticatedWebSession.get().signIn(sessionId,"");
    }

    protected void onSignInSucceeded()
    {
        // If login has been called because the user was not yet
        // logged in, than continue to the original destination,
        // otherwise to the Home page
        if (!continueToOriginalDestination())
        {
            setRedirect(true);

setResponsePage(getApplication().getSessionSettings().getPageFactory().newPage(
                    getApplication().getHomePage(), (PageParameters)null));
        }
    }

}

the problem is getting the    parameter   PARAM_SSI_SESSION_ID  the external
application will  redirect to a link like
http://hostname/myapp?PARAM_SSI_SESSION_ID=tert


any request to my application will be first cheked by authorization and
becasue the user is not signed in he will be redirected to SingInpage  in my
case SSIIntegrationLogin   , here I need the parameter
PARAM_SSI_SESSION_Id
now I was expecting the above code  to work but I never get the parameter
PARAM_SSI_SESSION_Id , please tell me how can I get this parameter ?   or is
there any beter way to handle this ?

Re: login with a parameter, no form

Posted by Igor Vaynberg <ig...@gmail.com>.
you can do it in any method, you have to do it in the one that checks
if the user is logged in.

-igor

On Fri, Dec 11, 2009 at 3:05 PM, fachhoch <fa...@gmail.com> wrote:
>
> I am sorry to ask you again, I did not understand , I am asking which method
> should I override in   auth strategy, which method in auth strategy  will I
> be able to do RequestCycle.get()  ,  get parameter  and  log in  user ?
>
> igor.vaynberg wrote:
>>
>> in your auth strategy simply call RequestCycle.get()
>>
>> -igor
>>
>> On Fri, Dec 11, 2009 at 2:53 PM, fachhoch <fa...@gmail.com> wrote:
>>>
>>> Please tell me  where is   there in the below text ?
>>>
>>> so check
>>> there for the parameter being present
>>>
>>> I saw the class SimplePageAuthorizationStrategy  but  could not figure
>>> out
>>> where  I can check for parameter  ?  Please tell me more .
>>>
>>>
>>>
>>> igor.vaynberg wrote:
>>>>
>>>> the auth strategy runs before your class is instantiated, so check
>>>> there for the parameter being present and log the user in.
>>>>
>>>> -igor
>>>>
>>>> On Fri, Dec 11, 2009 at 1:58 PM, tubin gen <fa...@gmail.com> wrote:
>>>>> My application does not authenticate user ,some external application
>>>>> authenticates and redirects to my application passing a parameter to
>>>>> identify the user, using this parameter I have to create a session and
>>>>> userdetails.
>>>>>
>>>>> I am using SimplePageAuthrizationStrategy
>>>>>
>>>>>
>>>>>        getSecuritySettings().setAuthorizationStrategy(new
>>>>> SimplePageAuthorizationStrategy(BasePage.class,getSignInPageClass()){
>>>>>            @Override
>>>>>            protected boolean isAuthorized() {
>>>>>                return ((AuditWebSession)Session.get()).isSignedIn();
>>>>>                //return true;
>>>>>            }
>>>>>        });
>>>>>
>>>>>
>>>>> here my SignInPage
>>>>>
>>>>> public class SSIIntegrationLogin extends WebPage {
>>>>>
>>>>>    private String sessionId;
>>>>>
>>>>>    public SSIIntegrationLogin(PageParameters  pageParameters) {
>>>>>
>>>>> sessionId=getRequestCycle().getRequest().getParameter(Parameters.PARAM_SSI_SESSION_ID);
>>>>>        if (signIn(sessionId)){
>>>>>            onSignInSucceeded();
>>>>>        }else{
>>>>>            onSignInFailed();
>>>>>        }
>>>>>    }
>>>>>
>>>>>    protected void onSignInFailed()
>>>>>    {
>>>>>        setRedirect(true);
>>>>>        setResponsePage(SingInFailedPage.class);
>>>>>    }
>>>>>
>>>>>
>>>>>    public boolean signIn(String sessionId)
>>>>>    {
>>>>>        return AuthenticatedWebSession.get().signIn(sessionId,"");
>>>>>    }
>>>>>
>>>>>    protected void onSignInSucceeded()
>>>>>    {
>>>>>        // If login has been called because the user was not yet
>>>>>        // logged in, than continue to the original destination,
>>>>>        // otherwise to the Home page
>>>>>        if (!continueToOriginalDestination())
>>>>>        {
>>>>>            setRedirect(true);
>>>>>
>>>>> setResponsePage(getApplication().getSessionSettings().getPageFactory().newPage(
>>>>>                    getApplication().getHomePage(),
>>>>> (PageParameters)null));
>>>>>        }
>>>>>    }
>>>>>
>>>>> }
>>>>>
>>>>> the problem is getting the    parameter   PARAM_SSI_SESSION_ID  the
>>>>> external
>>>>> application will  redirect to a link like
>>>>> http://hostname/myapp?PARAM_SSI_SESSION_ID=tert
>>>>>
>>>>>
>>>>> any request to my application will be first cheked by authorization and
>>>>> becasue the user is not signed in he will be redirected to SingInpage
>>>>>  in
>>>>> my
>>>>> case SSIIntegrationLogin   , here I need the parameter
>>>>> PARAM_SSI_SESSION_Id
>>>>> now I was expecting the above code  to work but I never get the
>>>>> parameter
>>>>> PARAM_SSI_SESSION_Id , please tell me how can I get this parameter ?
>>>>> or
>>>>> is
>>>>> there any beter way to handle this ?
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/login-with-a-parameter%2C-no-form-tp26752039p26752667.html
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>
> --
> View this message in context: http://old.nabble.com/login-with-a-parameter%2C-no-form-tp26752039p26752817.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: login with a parameter, no form

Posted by fachhoch <fa...@gmail.com>.
I am sorry to ask you again, I did not understand , I am asking which method
should I override in   auth strategy, which method in auth strategy  will I
be able to do RequestCycle.get()  ,  get parameter  and  log in  user ?

igor.vaynberg wrote:
> 
> in your auth strategy simply call RequestCycle.get()
> 
> -igor
> 
> On Fri, Dec 11, 2009 at 2:53 PM, fachhoch <fa...@gmail.com> wrote:
>>
>> Please tell me  where is   there in the below text ?
>>
>> so check
>> there for the parameter being present
>>
>> I saw the class SimplePageAuthorizationStrategy  but  could not figure
>> out
>> where  I can check for parameter  ?  Please tell me more .
>>
>>
>>
>> igor.vaynberg wrote:
>>>
>>> the auth strategy runs before your class is instantiated, so check
>>> there for the parameter being present and log the user in.
>>>
>>> -igor
>>>
>>> On Fri, Dec 11, 2009 at 1:58 PM, tubin gen <fa...@gmail.com> wrote:
>>>> My application does not authenticate user ,some external application
>>>> authenticates and redirects to my application passing a parameter to
>>>> identify the user, using this parameter I have to create a session and
>>>> userdetails.
>>>>
>>>> I am using SimplePageAuthrizationStrategy
>>>>
>>>>
>>>>        getSecuritySettings().setAuthorizationStrategy(new
>>>> SimplePageAuthorizationStrategy(BasePage.class,getSignInPageClass()){
>>>>            @Override
>>>>            protected boolean isAuthorized() {
>>>>                return ((AuditWebSession)Session.get()).isSignedIn();
>>>>                //return true;
>>>>            }
>>>>        });
>>>>
>>>>
>>>> here my SignInPage
>>>>
>>>> public class SSIIntegrationLogin extends WebPage {
>>>>
>>>>    private String sessionId;
>>>>
>>>>    public SSIIntegrationLogin(PageParameters  pageParameters) {
>>>>
>>>> sessionId=getRequestCycle().getRequest().getParameter(Parameters.PARAM_SSI_SESSION_ID);
>>>>        if (signIn(sessionId)){
>>>>            onSignInSucceeded();
>>>>        }else{
>>>>            onSignInFailed();
>>>>        }
>>>>    }
>>>>
>>>>    protected void onSignInFailed()
>>>>    {
>>>>        setRedirect(true);
>>>>        setResponsePage(SingInFailedPage.class);
>>>>    }
>>>>
>>>>
>>>>    public boolean signIn(String sessionId)
>>>>    {
>>>>        return AuthenticatedWebSession.get().signIn(sessionId,"");
>>>>    }
>>>>
>>>>    protected void onSignInSucceeded()
>>>>    {
>>>>        // If login has been called because the user was not yet
>>>>        // logged in, than continue to the original destination,
>>>>        // otherwise to the Home page
>>>>        if (!continueToOriginalDestination())
>>>>        {
>>>>            setRedirect(true);
>>>>
>>>> setResponsePage(getApplication().getSessionSettings().getPageFactory().newPage(
>>>>                    getApplication().getHomePage(),
>>>> (PageParameters)null));
>>>>        }
>>>>    }
>>>>
>>>> }
>>>>
>>>> the problem is getting the    parameter   PARAM_SSI_SESSION_ID  the
>>>> external
>>>> application will  redirect to a link like
>>>> http://hostname/myapp?PARAM_SSI_SESSION_ID=tert
>>>>
>>>>
>>>> any request to my application will be first cheked by authorization and
>>>> becasue the user is not signed in he will be redirected to SingInpage
>>>>  in
>>>> my
>>>> case SSIIntegrationLogin   , here I need the parameter
>>>> PARAM_SSI_SESSION_Id
>>>> now I was expecting the above code  to work but I never get the
>>>> parameter
>>>> PARAM_SSI_SESSION_Id , please tell me how can I get this parameter ?  
>>>> or
>>>> is
>>>> there any beter way to handle this ?
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/login-with-a-parameter%2C-no-form-tp26752039p26752667.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/login-with-a-parameter%2C-no-form-tp26752039p26752817.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: login with a parameter, no form

Posted by Igor Vaynberg <ig...@gmail.com>.
in your auth strategy simply call RequestCycle.get()

-igor

On Fri, Dec 11, 2009 at 2:53 PM, fachhoch <fa...@gmail.com> wrote:
>
> Please tell me  where is   there in the below text ?
>
> so check
> there for the parameter being present
>
> I saw the class SimplePageAuthorizationStrategy  but  could not figure out
> where  I can check for parameter  ?  Please tell me more .
>
>
>
> igor.vaynberg wrote:
>>
>> the auth strategy runs before your class is instantiated, so check
>> there for the parameter being present and log the user in.
>>
>> -igor
>>
>> On Fri, Dec 11, 2009 at 1:58 PM, tubin gen <fa...@gmail.com> wrote:
>>> My application does not authenticate user ,some external application
>>> authenticates and redirects to my application passing a parameter to
>>> identify the user, using this parameter I have to create a session and
>>> userdetails.
>>>
>>> I am using SimplePageAuthrizationStrategy
>>>
>>>
>>>        getSecuritySettings().setAuthorizationStrategy(new
>>> SimplePageAuthorizationStrategy(BasePage.class,getSignInPageClass()){
>>>            @Override
>>>            protected boolean isAuthorized() {
>>>                return ((AuditWebSession)Session.get()).isSignedIn();
>>>                //return true;
>>>            }
>>>        });
>>>
>>>
>>> here my SignInPage
>>>
>>> public class SSIIntegrationLogin extends WebPage {
>>>
>>>    private String sessionId;
>>>
>>>    public SSIIntegrationLogin(PageParameters  pageParameters) {
>>>
>>> sessionId=getRequestCycle().getRequest().getParameter(Parameters.PARAM_SSI_SESSION_ID);
>>>        if (signIn(sessionId)){
>>>            onSignInSucceeded();
>>>        }else{
>>>            onSignInFailed();
>>>        }
>>>    }
>>>
>>>    protected void onSignInFailed()
>>>    {
>>>        setRedirect(true);
>>>        setResponsePage(SingInFailedPage.class);
>>>    }
>>>
>>>
>>>    public boolean signIn(String sessionId)
>>>    {
>>>        return AuthenticatedWebSession.get().signIn(sessionId,"");
>>>    }
>>>
>>>    protected void onSignInSucceeded()
>>>    {
>>>        // If login has been called because the user was not yet
>>>        // logged in, than continue to the original destination,
>>>        // otherwise to the Home page
>>>        if (!continueToOriginalDestination())
>>>        {
>>>            setRedirect(true);
>>>
>>> setResponsePage(getApplication().getSessionSettings().getPageFactory().newPage(
>>>                    getApplication().getHomePage(),
>>> (PageParameters)null));
>>>        }
>>>    }
>>>
>>> }
>>>
>>> the problem is getting the    parameter   PARAM_SSI_SESSION_ID  the
>>> external
>>> application will  redirect to a link like
>>> http://hostname/myapp?PARAM_SSI_SESSION_ID=tert
>>>
>>>
>>> any request to my application will be first cheked by authorization and
>>> becasue the user is not signed in he will be redirected to SingInpage  in
>>> my
>>> case SSIIntegrationLogin   , here I need the parameter
>>> PARAM_SSI_SESSION_Id
>>> now I was expecting the above code  to work but I never get the parameter
>>> PARAM_SSI_SESSION_Id , please tell me how can I get this parameter ?   or
>>> is
>>> there any beter way to handle this ?
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>
> --
> View this message in context: http://old.nabble.com/login-with-a-parameter%2C-no-form-tp26752039p26752667.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: login with a parameter, no form

Posted by fachhoch <fa...@gmail.com>.
Please tell me  where is   there in the below text ?

so check
there for the parameter being present 

I saw the class SimplePageAuthorizationStrategy  but  could not figure out
where  I can check for parameter  ?  Please tell me more .



igor.vaynberg wrote:
> 
> the auth strategy runs before your class is instantiated, so check
> there for the parameter being present and log the user in.
> 
> -igor
> 
> On Fri, Dec 11, 2009 at 1:58 PM, tubin gen <fa...@gmail.com> wrote:
>> My application does not authenticate user ,some external application
>> authenticates and redirects to my application passing a parameter to
>> identify the user, using this parameter I have to create a session and
>> userdetails.
>>
>> I am using SimplePageAuthrizationStrategy
>>
>>
>>        getSecuritySettings().setAuthorizationStrategy(new
>> SimplePageAuthorizationStrategy(BasePage.class,getSignInPageClass()){
>>            @Override
>>            protected boolean isAuthorized() {
>>                return ((AuditWebSession)Session.get()).isSignedIn();
>>                //return true;
>>            }
>>        });
>>
>>
>> here my SignInPage
>>
>> public class SSIIntegrationLogin extends WebPage {
>>
>>    private String sessionId;
>>
>>    public SSIIntegrationLogin(PageParameters  pageParameters) {
>>
>> sessionId=getRequestCycle().getRequest().getParameter(Parameters.PARAM_SSI_SESSION_ID);
>>        if (signIn(sessionId)){
>>            onSignInSucceeded();
>>        }else{
>>            onSignInFailed();
>>        }
>>    }
>>
>>    protected void onSignInFailed()
>>    {
>>        setRedirect(true);
>>        setResponsePage(SingInFailedPage.class);
>>    }
>>
>>
>>    public boolean signIn(String sessionId)
>>    {
>>        return AuthenticatedWebSession.get().signIn(sessionId,"");
>>    }
>>
>>    protected void onSignInSucceeded()
>>    {
>>        // If login has been called because the user was not yet
>>        // logged in, than continue to the original destination,
>>        // otherwise to the Home page
>>        if (!continueToOriginalDestination())
>>        {
>>            setRedirect(true);
>>
>> setResponsePage(getApplication().getSessionSettings().getPageFactory().newPage(
>>                    getApplication().getHomePage(),
>> (PageParameters)null));
>>        }
>>    }
>>
>> }
>>
>> the problem is getting the    parameter   PARAM_SSI_SESSION_ID  the
>> external
>> application will  redirect to a link like
>> http://hostname/myapp?PARAM_SSI_SESSION_ID=tert
>>
>>
>> any request to my application will be first cheked by authorization and
>> becasue the user is not signed in he will be redirected to SingInpage  in
>> my
>> case SSIIntegrationLogin   , here I need the parameter
>> PARAM_SSI_SESSION_Id
>> now I was expecting the above code  to work but I never get the parameter
>> PARAM_SSI_SESSION_Id , please tell me how can I get this parameter ?   or
>> is
>> there any beter way to handle this ?
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/login-with-a-parameter%2C-no-form-tp26752039p26752667.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: login with a parameter, no form

Posted by Igor Vaynberg <ig...@gmail.com>.
the auth strategy runs before your class is instantiated, so check
there for the parameter being present and log the user in.

-igor

On Fri, Dec 11, 2009 at 1:58 PM, tubin gen <fa...@gmail.com> wrote:
> My application does not authenticate user ,some external application
> authenticates and redirects to my application passing a parameter to
> identify the user, using this parameter I have to create a session and
> userdetails.
>
> I am using SimplePageAuthrizationStrategy
>
>
>        getSecuritySettings().setAuthorizationStrategy(new
> SimplePageAuthorizationStrategy(BasePage.class,getSignInPageClass()){
>            @Override
>            protected boolean isAuthorized() {
>                return ((AuditWebSession)Session.get()).isSignedIn();
>                //return true;
>            }
>        });
>
>
> here my SignInPage
>
> public class SSIIntegrationLogin extends WebPage {
>
>    private String sessionId;
>
>    public SSIIntegrationLogin(PageParameters  pageParameters) {
>
> sessionId=getRequestCycle().getRequest().getParameter(Parameters.PARAM_SSI_SESSION_ID);
>        if (signIn(sessionId)){
>            onSignInSucceeded();
>        }else{
>            onSignInFailed();
>        }
>    }
>
>    protected void onSignInFailed()
>    {
>        setRedirect(true);
>        setResponsePage(SingInFailedPage.class);
>    }
>
>
>    public boolean signIn(String sessionId)
>    {
>        return AuthenticatedWebSession.get().signIn(sessionId,"");
>    }
>
>    protected void onSignInSucceeded()
>    {
>        // If login has been called because the user was not yet
>        // logged in, than continue to the original destination,
>        // otherwise to the Home page
>        if (!continueToOriginalDestination())
>        {
>            setRedirect(true);
>
> setResponsePage(getApplication().getSessionSettings().getPageFactory().newPage(
>                    getApplication().getHomePage(), (PageParameters)null));
>        }
>    }
>
> }
>
> the problem is getting the    parameter   PARAM_SSI_SESSION_ID  the external
> application will  redirect to a link like
> http://hostname/myapp?PARAM_SSI_SESSION_ID=tert
>
>
> any request to my application will be first cheked by authorization and
> becasue the user is not signed in he will be redirected to SingInpage  in my
> case SSIIntegrationLogin   , here I need the parameter
> PARAM_SSI_SESSION_Id
> now I was expecting the above code  to work but I never get the parameter
> PARAM_SSI_SESSION_Id , please tell me how can I get this parameter ?   or is
> there any beter way to handle this ?
>

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