You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Patrick Sansoucy <pa...@gmail.com> on 2015/11/18 04:34:38 UTC
Custom Authenticator Valve in Tomee
Hello,
I am in the process of writing a custom authenticator valve and most of the
sties I stumbled upon all point to modifying the
Authenticators.properties files
within the catalina.jar. I really want to avoid tempering with the
tomee/tomcat install in place, is there any other way to add a custom type
of authenticator. The best case scenario would be to have it setup via a
LazyValve but I doubt it is something available currently ...
Thanks for the info
Patrick Sansoucy
In theory, there is no difference between theory and practice, but in
practice, there is ...
Re: Custom Authenticator Valve in Tomee
Posted by Romain Manni-Bucau <rm...@gmail.com>.
EJB model and web model are still distinct. Agree with you on this one. CDI
everywhere will kind of make it obsolete soon.
Le 18 nov. 2015 20:18, "Patrick Sansoucy" <pa...@gmail.com> a
écrit :
> Yes, did'nt notice it earlier, my bad. But I noticed that I had to add my
> security-role's in the web.xml to make it work, since the BaseAuthenticator
> would throw me a 403 if only using the @DeclaredRoles on my EJB's. I
> thought it was two different ways of doing the same job ?!? Anyway been
> messing so much with this that I can't seem to think straight :(
> Thanks for the help
>
> Patrick Sansoucy
> In theory, there is no difference between theory and practice, but in
> practice, there is ...
>
> On Wed, Nov 18, 2015 at 9:22 PM, Romain Manni-Bucau <rmannibucau@gmail.com
> >
> wrote:
>
> > CombinedRealm as class or as entry point debugging? TomEERealm is a
> > CombinedRealm IIRC and is an expected wrapper of any realm.
> >
> > Romain Manni-Bucau
> > @rmannibucau | Blog | Github | LinkedIn | Tomitriber
> >
> >
> > 2015-11-18 18:01 GMT-08:00 Patrick Sansoucy <patrick.sansoucy@gmail.com
> >:
> > > Thanks for the reply,
> > > I have a weird behaviour, I have specified the following in my
> > context.xml
> > > <Context preemptiveAuthentication="true">
> > > <Valve className="org.apache.tomee.catalina.valve.LazyValve"
> > > delegateClassName="org.superbiz.authenticator.CustomAuthenticator" />
> > > <Realm className="org.apache.tomee.catalina.realm.LazyRealm" cdi="true"
> > > realmClass="org.superbiz.realm.CustomRealm" />
> > > </Context>
> > > My CustomAuthenticator is basically just a copy of the
> BasicAuthenticator
> > > valve (for testing purposes). What seems weird is that the following
> > code:
> > > Principal principal = context.getRealm().authenticate(username,
> > password);
> > > authenticates with the CombinedRealm and not my own CustomRealm ?!?
> > > I also commented out the login-config section of the web.xml.
> > >
> > > What I am trying to do is basically have my own custom authenticator
> > which
> > > would authenticate via my custom realm without having to alter the
> tomcat
> > > install or deploy other custom jars within tomcat ...
> > >
> > > Any help would be appreciated
> > > Thanks in advance
> > >
> > >
> > >
> > > Patrick Sansoucy
> > > In theory, there is no difference between theory and practice, but in
> > > practice, there is ...
> > >
> > > On Tue, Nov 17, 2015 at 10:46 PM, Romain Manni-Bucau <
> > rmannibucau@gmail.com>
> > > wrote:
> > >
> > >> Hi Patrick,
> > >>
> > >> you dont need to update this file if you just add an Authenticator in
> > >> context.xml/server.xml. It is only used for built in authenticator
> > >> method referenced in web.xml.
> > >> A custom authenticator wouldnt have the associated config in web.xml
> > >> so not sure what would be your plan then.
> > >>
> > >> Did i get it right?
> > >>
> > >>
> > >> Romain Manni-Bucau
> > >> @rmannibucau | Blog | Github | LinkedIn | Tomitriber
> > >>
> > >>
> > >> 2015-11-17 19:34 GMT-08:00 Patrick Sansoucy <
> patrick.sansoucy@gmail.com
> > >:
> > >> > Hello,
> > >> >
> > >> > I am in the process of writing a custom authenticator valve and most
> > of
> > >> the
> > >> > sties I stumbled upon all point to modifying the
> > >> > Authenticators.properties files
> > >> > within the catalina.jar. I really want to avoid tempering with the
> > >> > tomee/tomcat install in place, is there any other way to add a
> custom
> > >> type
> > >> > of authenticator. The best case scenario would be to have it setup
> > via a
> > >> > LazyValve but I doubt it is something available currently ...
> > >> >
> > >> > Thanks for the info
> > >> >
> > >> > Patrick Sansoucy
> > >> > In theory, there is no difference between theory and practice, but
> in
> > >> > practice, there is ...
> > >>
> >
>
Re: Custom Authenticator Valve in Tomee
Posted by Patrick Sansoucy <pa...@gmail.com>.
Yes, did'nt notice it earlier, my bad. But I noticed that I had to add my
security-role's in the web.xml to make it work, since the BaseAuthenticator
would throw me a 403 if only using the @DeclaredRoles on my EJB's. I
thought it was two different ways of doing the same job ?!? Anyway been
messing so much with this that I can't seem to think straight :(
Thanks for the help
Patrick Sansoucy
In theory, there is no difference between theory and practice, but in
practice, there is ...
On Wed, Nov 18, 2015 at 9:22 PM, Romain Manni-Bucau <rm...@gmail.com>
wrote:
> CombinedRealm as class or as entry point debugging? TomEERealm is a
> CombinedRealm IIRC and is an expected wrapper of any realm.
>
> Romain Manni-Bucau
> @rmannibucau | Blog | Github | LinkedIn | Tomitriber
>
>
> 2015-11-18 18:01 GMT-08:00 Patrick Sansoucy <pa...@gmail.com>:
> > Thanks for the reply,
> > I have a weird behaviour, I have specified the following in my
> context.xml
> > <Context preemptiveAuthentication="true">
> > <Valve className="org.apache.tomee.catalina.valve.LazyValve"
> > delegateClassName="org.superbiz.authenticator.CustomAuthenticator" />
> > <Realm className="org.apache.tomee.catalina.realm.LazyRealm" cdi="true"
> > realmClass="org.superbiz.realm.CustomRealm" />
> > </Context>
> > My CustomAuthenticator is basically just a copy of the BasicAuthenticator
> > valve (for testing purposes). What seems weird is that the following
> code:
> > Principal principal = context.getRealm().authenticate(username,
> password);
> > authenticates with the CombinedRealm and not my own CustomRealm ?!?
> > I also commented out the login-config section of the web.xml.
> >
> > What I am trying to do is basically have my own custom authenticator
> which
> > would authenticate via my custom realm without having to alter the tomcat
> > install or deploy other custom jars within tomcat ...
> >
> > Any help would be appreciated
> > Thanks in advance
> >
> >
> >
> > Patrick Sansoucy
> > In theory, there is no difference between theory and practice, but in
> > practice, there is ...
> >
> > On Tue, Nov 17, 2015 at 10:46 PM, Romain Manni-Bucau <
> rmannibucau@gmail.com>
> > wrote:
> >
> >> Hi Patrick,
> >>
> >> you dont need to update this file if you just add an Authenticator in
> >> context.xml/server.xml. It is only used for built in authenticator
> >> method referenced in web.xml.
> >> A custom authenticator wouldnt have the associated config in web.xml
> >> so not sure what would be your plan then.
> >>
> >> Did i get it right?
> >>
> >>
> >> Romain Manni-Bucau
> >> @rmannibucau | Blog | Github | LinkedIn | Tomitriber
> >>
> >>
> >> 2015-11-17 19:34 GMT-08:00 Patrick Sansoucy <patrick.sansoucy@gmail.com
> >:
> >> > Hello,
> >> >
> >> > I am in the process of writing a custom authenticator valve and most
> of
> >> the
> >> > sties I stumbled upon all point to modifying the
> >> > Authenticators.properties files
> >> > within the catalina.jar. I really want to avoid tempering with the
> >> > tomee/tomcat install in place, is there any other way to add a custom
> >> type
> >> > of authenticator. The best case scenario would be to have it setup
> via a
> >> > LazyValve but I doubt it is something available currently ...
> >> >
> >> > Thanks for the info
> >> >
> >> > Patrick Sansoucy
> >> > In theory, there is no difference between theory and practice, but in
> >> > practice, there is ...
> >>
>
Re: Custom Authenticator Valve in Tomee
Posted by Romain Manni-Bucau <rm...@gmail.com>.
CombinedRealm as class or as entry point debugging? TomEERealm is a
CombinedRealm IIRC and is an expected wrapper of any realm.
Romain Manni-Bucau
@rmannibucau | Blog | Github | LinkedIn | Tomitriber
2015-11-18 18:01 GMT-08:00 Patrick Sansoucy <pa...@gmail.com>:
> Thanks for the reply,
> I have a weird behaviour, I have specified the following in my context.xml
> <Context preemptiveAuthentication="true">
> <Valve className="org.apache.tomee.catalina.valve.LazyValve"
> delegateClassName="org.superbiz.authenticator.CustomAuthenticator" />
> <Realm className="org.apache.tomee.catalina.realm.LazyRealm" cdi="true"
> realmClass="org.superbiz.realm.CustomRealm" />
> </Context>
> My CustomAuthenticator is basically just a copy of the BasicAuthenticator
> valve (for testing purposes). What seems weird is that the following code:
> Principal principal = context.getRealm().authenticate(username, password);
> authenticates with the CombinedRealm and not my own CustomRealm ?!?
> I also commented out the login-config section of the web.xml.
>
> What I am trying to do is basically have my own custom authenticator which
> would authenticate via my custom realm without having to alter the tomcat
> install or deploy other custom jars within tomcat ...
>
> Any help would be appreciated
> Thanks in advance
>
>
>
> Patrick Sansoucy
> In theory, there is no difference between theory and practice, but in
> practice, there is ...
>
> On Tue, Nov 17, 2015 at 10:46 PM, Romain Manni-Bucau <rm...@gmail.com>
> wrote:
>
>> Hi Patrick,
>>
>> you dont need to update this file if you just add an Authenticator in
>> context.xml/server.xml. It is only used for built in authenticator
>> method referenced in web.xml.
>> A custom authenticator wouldnt have the associated config in web.xml
>> so not sure what would be your plan then.
>>
>> Did i get it right?
>>
>>
>> Romain Manni-Bucau
>> @rmannibucau | Blog | Github | LinkedIn | Tomitriber
>>
>>
>> 2015-11-17 19:34 GMT-08:00 Patrick Sansoucy <pa...@gmail.com>:
>> > Hello,
>> >
>> > I am in the process of writing a custom authenticator valve and most of
>> the
>> > sties I stumbled upon all point to modifying the
>> > Authenticators.properties files
>> > within the catalina.jar. I really want to avoid tempering with the
>> > tomee/tomcat install in place, is there any other way to add a custom
>> type
>> > of authenticator. The best case scenario would be to have it setup via a
>> > LazyValve but I doubt it is something available currently ...
>> >
>> > Thanks for the info
>> >
>> > Patrick Sansoucy
>> > In theory, there is no difference between theory and practice, but in
>> > practice, there is ...
>>
Re: Custom Authenticator Valve in Tomee
Posted by Patrick Sansoucy <pa...@gmail.com>.
Thanks for the reply,
I have a weird behaviour, I have specified the following in my context.xml
<Context preemptiveAuthentication="true">
<Valve className="org.apache.tomee.catalina.valve.LazyValve"
delegateClassName="org.superbiz.authenticator.CustomAuthenticator" />
<Realm className="org.apache.tomee.catalina.realm.LazyRealm" cdi="true"
realmClass="org.superbiz.realm.CustomRealm" />
</Context>
My CustomAuthenticator is basically just a copy of the BasicAuthenticator
valve (for testing purposes). What seems weird is that the following code:
Principal principal = context.getRealm().authenticate(username, password);
authenticates with the CombinedRealm and not my own CustomRealm ?!?
I also commented out the login-config section of the web.xml.
What I am trying to do is basically have my own custom authenticator which
would authenticate via my custom realm without having to alter the tomcat
install or deploy other custom jars within tomcat ...
Any help would be appreciated
Thanks in advance
Patrick Sansoucy
In theory, there is no difference between theory and practice, but in
practice, there is ...
On Tue, Nov 17, 2015 at 10:46 PM, Romain Manni-Bucau <rm...@gmail.com>
wrote:
> Hi Patrick,
>
> you dont need to update this file if you just add an Authenticator in
> context.xml/server.xml. It is only used for built in authenticator
> method referenced in web.xml.
> A custom authenticator wouldnt have the associated config in web.xml
> so not sure what would be your plan then.
>
> Did i get it right?
>
>
> Romain Manni-Bucau
> @rmannibucau | Blog | Github | LinkedIn | Tomitriber
>
>
> 2015-11-17 19:34 GMT-08:00 Patrick Sansoucy <pa...@gmail.com>:
> > Hello,
> >
> > I am in the process of writing a custom authenticator valve and most of
> the
> > sties I stumbled upon all point to modifying the
> > Authenticators.properties files
> > within the catalina.jar. I really want to avoid tempering with the
> > tomee/tomcat install in place, is there any other way to add a custom
> type
> > of authenticator. The best case scenario would be to have it setup via a
> > LazyValve but I doubt it is something available currently ...
> >
> > Thanks for the info
> >
> > Patrick Sansoucy
> > In theory, there is no difference between theory and practice, but in
> > practice, there is ...
>
Re: Custom Authenticator Valve in Tomee
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi Patrick,
you dont need to update this file if you just add an Authenticator in
context.xml/server.xml. It is only used for built in authenticator
method referenced in web.xml.
A custom authenticator wouldnt have the associated config in web.xml
so not sure what would be your plan then.
Did i get it right?
Romain Manni-Bucau
@rmannibucau | Blog | Github | LinkedIn | Tomitriber
2015-11-17 19:34 GMT-08:00 Patrick Sansoucy <pa...@gmail.com>:
> Hello,
>
> I am in the process of writing a custom authenticator valve and most of the
> sties I stumbled upon all point to modifying the
> Authenticators.properties files
> within the catalina.jar. I really want to avoid tempering with the
> tomee/tomcat install in place, is there any other way to add a custom type
> of authenticator. The best case scenario would be to have it setup via a
> LazyValve but I doubt it is something available currently ...
>
> Thanks for the info
>
> Patrick Sansoucy
> In theory, there is no difference between theory and practice, but in
> practice, there is ...