You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by lev <di...@amdocs.com> on 2010/01/14 13:33:06 UTC

Re: Multiple Realms from single application.

Hi,

I think nobody understands this problem well till now,

I think i underdstand this problem as i also am struggling with it.

My problem is to have two kind of authetications for users of tw different
apps.

i have app1 and app2 being autheticated by one shiro instance, users of app1
need to be autheticated by user/password way and users of app2 need to be
autheticated by social id and phone numebr or someting else...

can somebody tell how to this too...please help on this..


kaosko wrote:
> 
> You can configure an unlimited number of realms for a single security
> manager and they can freely choose whether they participate in
> authenticating a particular subject. By default, it's enough that just
> one of them can authenticate a given principal. Basically you
> configure/implement a realm for each authenticating server.
> 
> Kalle
> 
> 
> On Wed, Dec 23, 2009 at 7:39 PM, SSam <SS...@yahoo.com> wrote:
>>
>> Hi Narcom,
>> Thanks for reply.
>>
>> I am not sure I have explained the issue properly.
>> My WebServices Application need to support multiple authentication
>> servers
>> (LDAP, RADIUS, MYSQL) simultaniousely.   Currenntly we are using  kind of
>> groupname mapping to backend server.   When user authentication request
>> comes along with groupname we send  the request to respective backend
>> server
>> based on group information.  I would like to replace the entire
>> authentication module with flexible SHIRO module.
>>
>> Is there any example to use multiple authentication servers/realms?  How
>> does the application know which realm to use for
>> authentication/authirazation?
>>
>> I am just start learning shiro. Can you please give the url if any
>> example
>> avilable.
>>
>> Thanks,
>> Sam.
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://n2.nabble.com/Multiple-Realms-from-single-application-tp4211037p4211779.html
>> Sent from the Shiro User mailing list archive at Nabble.com.
>>
> 
> 

-- 
View this message in context: http://n2.nabble.com/Multiple-Realms-from-single-application-tp4211037p4392230.html
Sent from the Shiro User mailing list archive at Nabble.com.

Re: Multiple Realms from single application.

Posted by Les Hazlewood <lh...@apache.org>.
Yes, Brian is correct:

Configure both realms.  Create a new
org.apache.shiro.authc.AuthenticationToken implementation for your
social ID data.  When a user logs in with username/password, submit a
UsernamePasswordToken instance to the subject.login method.  When they
log in with the social ID, submit your SocialIdToken instance instead.

In your SocialIdRealm implementation (if it is a subclass of
AuthenticatingRealm, as it probably should be), all you have to do is
this in the constructor:

public SocialIdRealm() {
    setAuthenticationTokenClass(SocialIdToken.class);
    ...
}

This will make the Realm.supports(token) method return false for any
instances _other_ than a SocialIdToken.  Shiro's authentication
strategy will only interact with Realms that support the
AuthenticationToken instance.

That's it!

Cheers,

Les

On Thu, Jan 14, 2010 at 8:57 AM, Brian Demers <br...@gmail.com> wrote:
>
> You just need to configure multiple realms if both apps are hitting the same
> shiro instance.  Take a look at the doc for ModularRealmAuthenticator.
>
> Your Social id realm just needs to use some other sort of auth token
>
>
>
>
> On Thu, Jan 14, 2010 at 7:33 AM, lev <di...@amdocs.com> wrote:
>>
>> Hi,
>>
>> I think nobody understands this problem well till now,
>>
>> I think i underdstand this problem as i also am struggling with it.
>>
>> My problem is to have two kind of authetications for users of tw different
>> apps.
>>
>> i have app1 and app2 being autheticated by one shiro instance, users of
>> app1
>> need to be autheticated by user/password way and users of app2 need to be
>> autheticated by social id and phone numebr or someting else...
>>
>> can somebody tell how to this too...please help on this..
>>
>>
>> kaosko wrote:
>> >
>> > You can configure an unlimited number of realms for a single security
>> > manager and they can freely choose whether they participate in
>> > authenticating a particular subject. By default, it's enough that just
>> > one of them can authenticate a given principal. Basically you
>> > configure/implement a realm for each authenticating server.
>> >
>> > Kalle
>> >
>> >
>> > On Wed, Dec 23, 2009 at 7:39 PM, SSam <SS...@yahoo.com> wrote:
>> >>
>> >> Hi Narcom,
>> >> Thanks for reply.
>> >>
>> >> I am not sure I have explained the issue properly.
>> >> My WebServices Application need to support multiple authentication
>> >> servers
>> >> (LDAP, RADIUS, MYSQL) simultaniousely.   Currenntly we are using  kind
>> >> of
>> >> groupname mapping to backend server.   When user authentication request
>> >> comes along with groupname we send  the request to respective backend
>> >> server
>> >> based on group information.  I would like to replace the entire
>> >> authentication module with flexible SHIRO module.
>> >>
>> >> Is there any example to use multiple authentication servers/realms?
>> >>  How
>> >> does the application know which realm to use for
>> >> authentication/authirazation?
>> >>
>> >> I am just start learning shiro. Can you please give the url if any
>> >> example
>> >> avilable.
>> >>
>> >> Thanks,
>> >> Sam.
>> >>
>> >>
>> >>
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> >> http://n2.nabble.com/Multiple-Realms-from-single-application-tp4211037p4211779.html
>> >> Sent from the Shiro User mailing list archive at Nabble.com.
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://n2.nabble.com/Multiple-Realms-from-single-application-tp4211037p4392230.html
>> Sent from the Shiro User mailing list archive at Nabble.com.
>
>

Re: Multiple Realms from single application.

Posted by Brian Demers <br...@gmail.com>.
You just need to configure multiple realms if both apps are hitting the same
shiro instance.  Take a look at the doc for ModularRealmAuthenticator.

Your Social id realm just needs to use some other sort of auth token




On Thu, Jan 14, 2010 at 7:33 AM, lev <di...@amdocs.com> wrote:
>
> Hi,
>
> I think nobody understands this problem well till now,
>
> I think i underdstand this problem as i also am struggling with it.
>
> My problem is to have two kind of authetications for users of tw different
> apps.
>
> i have app1 and app2 being autheticated by one shiro instance, users of
app1
> need to be autheticated by user/password way and users of app2 need to be
> autheticated by social id and phone numebr or someting else...
>
> can somebody tell how to this too...please help on this..
>
>
> kaosko wrote:
> >
> > You can configure an unlimited number of realms for a single security
> > manager and they can freely choose whether they participate in
> > authenticating a particular subject. By default, it's enough that just
> > one of them can authenticate a given principal. Basically you
> > configure/implement a realm for each authenticating server.
> >
> > Kalle
> >
> >
> > On Wed, Dec 23, 2009 at 7:39 PM, SSam <SS...@yahoo.com> wrote:
> >>
> >> Hi Narcom,
> >> Thanks for reply.
> >>
> >> I am not sure I have explained the issue properly.
> >> My WebServices Application need to support multiple authentication
> >> servers
> >> (LDAP, RADIUS, MYSQL) simultaniousely.   Currenntly we are using  kind
of
> >> groupname mapping to backend server.   When user authentication request
> >> comes along with groupname we send  the request to respective backend
> >> server
> >> based on group information.  I would like to replace the entire
> >> authentication module with flexible SHIRO module.
> >>
> >> Is there any example to use multiple authentication servers/realms?
 How
> >> does the application know which realm to use for
> >> authentication/authirazation?
> >>
> >> I am just start learning shiro. Can you please give the url if any
> >> example
> >> avilable.
> >>
> >> Thanks,
> >> Sam.
> >>
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
http://n2.nabble.com/Multiple-Realms-from-single-application-tp4211037p4211779.html
> >> Sent from the Shiro User mailing list archive at Nabble.com.
> >>
> >
> >
>
> --
> View this message in context:
http://n2.nabble.com/Multiple-Realms-from-single-application-tp4211037p4392230.html
> Sent from the Shiro User mailing list archive at Nabble.com.