You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by Gabriel Titerlea <ga...@sync.ro> on 2016/08/22 12:24:06 UTC

custom in shiro.ini

Hi,

What is the "custom" variable in the shiro.ini? I am trying to use 
buji-pac4j and I see that in a demo application [1] it uses a "custom" 
variable.
Where is this variable defined? What is it used for?

I see that it is used like this: custom:$customAuthorizer.
And the variable customAuthorizer is defined above: customAuthorizer= 
org.pac4j.demo.shiro.CustomAuthorizer

Why not use $customAuthorizer directly? Is custom used as a namespace 
for user-defined variables?

[1] 
https://github.com/pac4j/buji-pac4j-demo/blob/master/src/main/resources/shiro.ini

Regards,
Gabriel

Re: custom in shiro.ini

Posted by Gabriel Titerlea <ga...@sync.ro>.
Yes, perfect explanation.
Thank you!


On 22-Aug-16 17:05, Brian Demers wrote:
> In this case both 'customAuthorizer' and 'config' define which class is used.
> After 'config' is instantiated config.setAuthorizers(Map) would be
> called.  In this case the map contains two entries with keys 'admin'
> and 'custom'.  (with values being the instances represented by
> '$requireRoleAdmin' and '$customAuthorizer'
>
> customAuthorizer = org.pac4j.demo.shiro.CustomAuthorizer
> config = org.pac4j.core.config.Config
> config.authorizers = admin:$requireRoleAdmin,custom:$customAuthorizer
>
>
> Does that help?
>
> On Mon, Aug 22, 2016 at 8:24 AM, Gabriel Titerlea
> <ga...@sync.ro> wrote:
>> Hi,
>>
>> What is the "custom" variable in the shiro.ini? I am trying to use
>> buji-pac4j and I see that in a demo application [1] it uses a "custom"
>> variable.
>> Where is this variable defined? What is it used for?
>>
>> I see that it is used like this: custom:$customAuthorizer.
>> And the variable customAuthorizer is defined above: customAuthorizer =
>> org.pac4j.demo.shiro.CustomAuthorizer
>>
>> Why not use $customAuthorizer directly? Is custom used as a namespace for
>> user-defined variables?
>>
>> [1]
>> https://github.com/pac4j/buji-pac4j-demo/blob/master/src/main/resources/shiro.ini
>>
>> Regards,
>> Gabriel

-- 

Gabriel Titerlea
<oXygen/> XML Web Author
https://www.oxygenxml.com


Re: custom in shiro.ini

Posted by Brian Demers <br...@gmail.com>.
In this case both 'customAuthorizer' and 'config' define which class is used.
After 'config' is instantiated config.setAuthorizers(Map) would be
called.  In this case the map contains two entries with keys 'admin'
and 'custom'.  (with values being the instances represented by
'$requireRoleAdmin' and '$customAuthorizer'

customAuthorizer = org.pac4j.demo.shiro.CustomAuthorizer
config = org.pac4j.core.config.Config
config.authorizers = admin:$requireRoleAdmin,custom:$customAuthorizer


Does that help?

On Mon, Aug 22, 2016 at 8:24 AM, Gabriel Titerlea
<ga...@sync.ro> wrote:
> Hi,
>
> What is the "custom" variable in the shiro.ini? I am trying to use
> buji-pac4j and I see that in a demo application [1] it uses a "custom"
> variable.
> Where is this variable defined? What is it used for?
>
> I see that it is used like this: custom:$customAuthorizer.
> And the variable customAuthorizer is defined above: customAuthorizer =
> org.pac4j.demo.shiro.CustomAuthorizer
>
> Why not use $customAuthorizer directly? Is custom used as a namespace for
> user-defined variables?
>
> [1]
> https://github.com/pac4j/buji-pac4j-demo/blob/master/src/main/resources/shiro.ini
>
> Regards,
> Gabriel