You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by sailendra karthik <ka...@gmail.com> on 2011/10/14 23:36:37 UTC
Session across Realm and Servlet
I need to maintain a session object between Realm and Servlet.
I have written a CustomRealm and every thing working fine and now it
is required to send an object to servlets (possibly by
HttpRequestServlet ) But i know/think Servlet is not yet Initiated.
So how it is possible to access HttpRequestServlet and set some
session attribute in my Custom Realm which extends RealmBase.
Or else it should be a different Procedure.
Waiting for some clue.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Session across Realm and Servlet
Posted by Pid <pi...@pidster.com>.
On 16/10/2011 12:01, sailendra karthik wrote:
> On Sun, Oct 16, 2011 at 2:25 PM, Pid <pi...@pidster.com> wrote:
>
>> On 16/10/2011 05:57, sailendra karthik wrote:
>>> On 10/16/11, sailendra karthik <ka...@gmail.com> wrote:
>>>> On 10/15/11, Pid <pi...@pidster.com> wrote:
>>>>> On 14/10/2011 22:36, sailendra karthik wrote:
>>>>>> I need to maintain a session object between Realm and Servlet.
>>>>>>
>>>>>> I have written a CustomRealm and every thing working fine and now it
>>>>>> is required to send an object to servlets (possibly by
>>>>>> HttpRequestServlet ) But i know/think Servlet is not yet Initiated.
>>>>>>
>>>>>> So how it is possible to access HttpRequestServlet and set some
>>>>>> session attribute in my Custom Realm which extends RealmBase.
>>>>>>
>>>>>> Or else it should be a different Procedure.
>>>>>>
>>>>>> Waiting for some clue.
>>>>>
>>>>> This is clear, but so are we. Which version of Tomcat for example?
>>>>>
>>>>>
>>>>> p
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> Tomcat 6.0.22
>>>>
>>>
>>> As you asked about version of Tomcat,
>>>
>>> Is it possible in some tomcat version, if yes, can you tell me that
>>> version and which portion in
>>> that tomcat version(like few classes) makes it possible.
>>
>> You are trying, for some reason, to force a Realm and a Servlet to
>> interact directly. Don't do this.
>>
>> What is the real problem, why do you need a custom realm implementation?
>>
>> For what purpose are you setting an object in the session?
>>
>>
>> p
>>
>> Real Problem :-
>>
> In my Custom Realm Implementation iam autheticating some user and allowing
> him to access my webapps(servlets or filters) (my application)
What's wrong with the existing realms?
> This authentication session i need it to be reused in my webapp(to avoid
> another authentication) if it is an authorized session.
What's wrong with the existing container functionality?
> So for this purpose i want to set an object in the session and reuse that
> object(connection Object) at my servlets level.
What kind of object?
p
> How can i over come this
>
Re: Session across Realm and Servlet
Posted by Tim Watts <ti...@cliftonfarm.org>.
On Mon, 2011-10-17 at 01:10 +0530, sailendra karthik wrote:
> On Sun, Oct 16, 2011 at 5:16 PM, Chema <de...@gmail.com> wrote:
>
> > > In my Custom Realm Implementation iam autheticating some user and
> > > allowing
> > > him to access my webapps(servlets or filters) (my application)
> > > This authentication session i need it to be reused in my webapp(to avoid
> > > another authentication) if it is an authorized session.
> > > So for this purpose i want to set an object in the session and reuse
> > that
> > > object(connection Object) at my servlets level.
> > >
> > > How can i over come this
> > >
> >
> >
> > You can use a Filter and check if remote user is setted.
> > I do it this way to load user info into user http session
> >
>
> As you said that can work using Filters,
> But the requirement is that it needs Tomcat level authentication.
>
> or else i dont know whether i completely misunderstood the concept of
> realms.
>From what you've described so far, I see no reason why the standard
realms tomcat provides wouldn't meet your needs. I suggest that you may
not quite understand how the standard authentication mechanisms work.
Try re-reading the documentation on them. No sense re-inventing a wheel
that already rolls to your satisfaction. Or are we missing some crucial
details?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Session across Realm and Servlet
Posted by sailendra karthik <ka...@gmail.com>.
On Sun, Oct 16, 2011 at 5:16 PM, Chema <de...@gmail.com> wrote:
> > In my Custom Realm Implementation iam autheticating some user and
> > allowing
> > him to access my webapps(servlets or filters) (my application)
> > This authentication session i need it to be reused in my webapp(to avoid
> > another authentication) if it is an authorized session.
> > So for this purpose i want to set an object in the session and reuse
> that
> > object(connection Object) at my servlets level.
> >
> > How can i over come this
> >
>
>
> You can use a Filter and check if remote user is setted.
> I do it this way to load user info into user http session
>
As you said that can work using Filters,
But the requirement is that it needs Tomcat level authentication.
or else i dont know whether i completely misunderstood the concept of
realms.
Re: Session across Realm and Servlet
Posted by Chema <de...@gmail.com>.
> In my Custom Realm Implementation iam autheticating some user and
> allowing
> him to access my webapps(servlets or filters) (my application)
> This authentication session i need it to be reused in my webapp(to avoid
> another authentication) if it is an authorized session.
> So for this purpose i want to set an object in the session and reuse that
> object(connection Object) at my servlets level.
>
> How can i over come this
>
You can use a Filter and check if remote user is setted.
I do it this way to load user info into user http session
Re: Session across Realm and Servlet
Posted by sailendra karthik <ka...@gmail.com>.
On Sun, Oct 16, 2011 at 2:25 PM, Pid <pi...@pidster.com> wrote:
> On 16/10/2011 05:57, sailendra karthik wrote:
> > On 10/16/11, sailendra karthik <ka...@gmail.com> wrote:
> >> On 10/15/11, Pid <pi...@pidster.com> wrote:
> >>> On 14/10/2011 22:36, sailendra karthik wrote:
> >>>> I need to maintain a session object between Realm and Servlet.
> >>>>
> >>>> I have written a CustomRealm and every thing working fine and now it
> >>>> is required to send an object to servlets (possibly by
> >>>> HttpRequestServlet ) But i know/think Servlet is not yet Initiated.
> >>>>
> >>>> So how it is possible to access HttpRequestServlet and set some
> >>>> session attribute in my Custom Realm which extends RealmBase.
> >>>>
> >>>> Or else it should be a different Procedure.
> >>>>
> >>>> Waiting for some clue.
> >>>
> >>> This is clear, but so are we. Which version of Tomcat for example?
> >>>
> >>>
> >>> p
> >>>
> >>>
> >>>
> >>
> >>
> >> Tomcat 6.0.22
> >>
> >
> > As you asked about version of Tomcat,
> >
> > Is it possible in some tomcat version, if yes, can you tell me that
> > version and which portion in
> > that tomcat version(like few classes) makes it possible.
>
> You are trying, for some reason, to force a Realm and a Servlet to
> interact directly. Don't do this.
>
> What is the real problem, why do you need a custom realm implementation?
>
> For what purpose are you setting an object in the session?
>
>
> p
>
> Real Problem :-
>
In my Custom Realm Implementation iam autheticating some user and allowing
him to access my webapps(servlets or filters) (my application)
This authentication session i need it to be reused in my webapp(to avoid
another authentication) if it is an authorized session.
So for this purpose i want to set an object in the session and reuse that
object(connection Object) at my servlets level.
How can i over come this
Re: Session across Realm and Servlet
Posted by Pid <pi...@pidster.com>.
On 16/10/2011 05:57, sailendra karthik wrote:
> On 10/16/11, sailendra karthik <ka...@gmail.com> wrote:
>> On 10/15/11, Pid <pi...@pidster.com> wrote:
>>> On 14/10/2011 22:36, sailendra karthik wrote:
>>>> I need to maintain a session object between Realm and Servlet.
>>>>
>>>> I have written a CustomRealm and every thing working fine and now it
>>>> is required to send an object to servlets (possibly by
>>>> HttpRequestServlet ) But i know/think Servlet is not yet Initiated.
>>>>
>>>> So how it is possible to access HttpRequestServlet and set some
>>>> session attribute in my Custom Realm which extends RealmBase.
>>>>
>>>> Or else it should be a different Procedure.
>>>>
>>>> Waiting for some clue.
>>>
>>> This is clear, but so are we. Which version of Tomcat for example?
>>>
>>>
>>> p
>>>
>>>
>>>
>>
>>
>> Tomcat 6.0.22
>>
>
> As you asked about version of Tomcat,
>
> Is it possible in some tomcat version, if yes, can you tell me that
> version and which portion in
> that tomcat version(like few classes) makes it possible.
You are trying, for some reason, to force a Realm and a Servlet to
interact directly. Don't do this.
What is the real problem, why do you need a custom realm implementation?
For what purpose are you setting an object in the session?
p
Re: Session across Realm and Servlet
Posted by sailendra karthik <ka...@gmail.com>.
On 10/16/11, sailendra karthik <ka...@gmail.com> wrote:
> On 10/15/11, Pid <pi...@pidster.com> wrote:
>> On 14/10/2011 22:36, sailendra karthik wrote:
>>> I need to maintain a session object between Realm and Servlet.
>>>
>>> I have written a CustomRealm and every thing working fine and now it
>>> is required to send an object to servlets (possibly by
>>> HttpRequestServlet ) But i know/think Servlet is not yet Initiated.
>>>
>>> So how it is possible to access HttpRequestServlet and set some
>>> session attribute in my Custom Realm which extends RealmBase.
>>>
>>> Or else it should be a different Procedure.
>>>
>>> Waiting for some clue.
>>
>> This is clear, but so are we. Which version of Tomcat for example?
>>
>>
>> p
>>
>>
>>
>
>
> Tomcat 6.0.22
>
As you asked about version of Tomcat,
Is it possible in some tomcat version, if yes, can you tell me that
version and which portion in
that tomcat version(like few classes) makes it possible.
Thanks
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Session across Realm and Servlet
Posted by sailendra karthik <ka...@gmail.com>.
On 10/15/11, Pid <pi...@pidster.com> wrote:
> On 14/10/2011 22:36, sailendra karthik wrote:
>> I need to maintain a session object between Realm and Servlet.
>>
>> I have written a CustomRealm and every thing working fine and now it
>> is required to send an object to servlets (possibly by
>> HttpRequestServlet ) But i know/think Servlet is not yet Initiated.
>>
>> So how it is possible to access HttpRequestServlet and set some
>> session attribute in my Custom Realm which extends RealmBase.
>>
>> Or else it should be a different Procedure.
>>
>> Waiting for some clue.
>
> This is clear, but so are we. Which version of Tomcat for example?
>
>
> p
>
>
>
Tomcat 6.0.22
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Session across Realm and Servlet
Posted by Pid <pi...@pidster.com>.
On 14/10/2011 22:36, sailendra karthik wrote:
> I need to maintain a session object between Realm and Servlet.
>
> I have written a CustomRealm and every thing working fine and now it
> is required to send an object to servlets (possibly by
> HttpRequestServlet ) But i know/think Servlet is not yet Initiated.
>
> So how it is possible to access HttpRequestServlet and set some
> session attribute in my Custom Realm which extends RealmBase.
>
> Or else it should be a different Procedure.
>
> Waiting for some clue.
This is clear, but so are we. Which version of Tomcat for example?
p
Re: Session across Realm and Servlet
Posted by sailendra karthik <ka...@gmail.com>.
On 10/15/11, Chema <de...@gmail.com> wrote:
>>
>> So how it is possible to access HttpRequestServlet and set some
>> session attribute in my Custom Realm which extends RealmBase.
>>
>
>
> I guess you can't do it that
>
>
>>
>> Or else it should be a different Procedure.
>>
>
>
> You can try by using filters or try Spring Security
>
>
>
>>
>> Waiting for some clue.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
Thanks for the reply.
1.Actually as of now iam using a customValve by extending ValveBase
and there is a abstract
invoke method there iam implementing it .
2 .and now it is possible for me to use add sessions and get sessions
in the jsps
3. and now whats happening is this invoke method is getting triggered before my
CustomRealm's authenticate method.
(Now iam checking how to add session after triggering)
But it is clear that this Valve --> Filter
Realm --> Servlet (Just
an analogy i assumed and happening)
As You said Filters or Spring-context
Spring-security --> i dont have any idea
Filters --> not helpful
So Valve side or else Spring-security give me some information.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Session across Realm and Servlet
Posted by Chema <de...@gmail.com>.
>
> So how it is possible to access HttpRequestServlet and set some
> session attribute in my Custom Realm which extends RealmBase.
>
I guess you can't do it that
>
> Or else it should be a different Procedure.
>
You can try by using filters or try Spring Security
>
> Waiting for some clue.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>