You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by Sreyan Chakravarty <sr...@gmail.com> on 2015/10/05 18:08:00 UTC

Re: Realm Authorization

Had the same problem. Unfortunately there aren't much examples and you
probably won't get much help from the mailing list.

On Tue, Sep 29, 2015 at 3:07 AM, slowtrailrunner <ho...@gmail.com> wrote:

> Does anyone know if there are plans to finish the docs on Realm
> Authorization
> <http://shiro.apache.org/realm.html#Realm-RealmAuthorization>   or can
> someone point me to some examples?
>
> Thank you,
> Jason
>
>
>
> --
> View this message in context:
> http://shiro-user.582556.n2.nabble.com/Realm-Authorization-tp7580793.html
> Sent from the Shiro User mailing list archive at Nabble.com.
>

Re: Realm Authorization

Posted by Christian Wolfe <ta...@gmail.com>.
Basically, you have to create a Realm that subclasses AuthorizingRealm.
There are a few out-of-the-box implementations that already do this,
including TextConfigurationRealm.

The main method which you'll need to focus on is doGetAuthorizationInfo.
This method will be called whenever some action is performed which requires
authorization. The method is given a collection of principals for the
current user. You use these principals to look up the user's roles and
permissions, and then store these roles and permissions in an object that
implements the AuthorizationInfo interface (again, a few premade classes do
this, such as SimpleAccount). Lastly, have the method return this object.
Shiro will use it to determine whether a user is authorized to do something.

On Mon, Oct 5, 2015 at 4:10 PM, armandoxxx <ar...@dropchop.com> wrote:

> it'a really simple .. all you have to do is load roles and permissions into
> authorization info and return the class ... the problem with this is that
> It's beeing called multiple times ... so cache loaded data ...
>
> Regards
>
> Armando
>
>
>
> --
> View this message in context:
> http://shiro-user.582556.n2.nabble.com/Re-Realm-Authorization-tp7580800p7580802.html
> Sent from the Shiro User mailing list archive at Nabble.com.
>

Re: Realm Authorization

Posted by armandoxxx <ar...@dropchop.com>.

this is one of our realms ... Principal, Role and SecurityManager are out
implementations that load permissions data from storage and resolve into
shiro Permission object ... Role.getName() returns role name for shiro ...
so in the end .. shiroPermissions are real wildcard shiro permissions ... 

regards

Armando



--
View this message in context: http://shiro-user.582556.n2.nabble.com/Re-Realm-Authorization-tp7580800p7580804.html
Sent from the Shiro User mailing list archive at Nabble.com.

Re: Realm Authorization

Posted by armandoxxx <ar...@dropchop.com>.
it'a really simple .. all you have to do is load roles and permissions into
authorization info and return the class ... the problem with this is that
It's beeing called multiple times ... so cache loaded data ... 

Regards

Armando 



--
View this message in context: http://shiro-user.582556.n2.nabble.com/Re-Realm-Authorization-tp7580800p7580802.html
Sent from the Shiro User mailing list archive at Nabble.com.

Re: Realm Authorization

Posted by Christian Wolfe <ta...@gmail.com>.
Do you mean you're looking for examples on how to use a realm to perform
authorization?

On Mon, Oct 5, 2015 at 12:08 PM, Sreyan Chakravarty <
sreyan.mailing@gmail.com> wrote:

> Had the same problem. Unfortunately there aren't much examples and you
> probably won't get much help from the mailing list.
>
> On Tue, Sep 29, 2015 at 3:07 AM, slowtrailrunner <ho...@gmail.com>
> wrote:
>
>> Does anyone know if there are plans to finish the docs on Realm
>> Authorization
>> <http://shiro.apache.org/realm.html#Realm-RealmAuthorization>   or can
>> someone point me to some examples?
>>
>> Thank you,
>> Jason
>>
>>
>>
>> --
>> View this message in context:
>> http://shiro-user.582556.n2.nabble.com/Realm-Authorization-tp7580793.html
>> Sent from the Shiro User mailing list archive at Nabble.com.
>>
>
>