You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by Todd Nine <tn...@apigee.com> on 2013/11/09 20:24:42 UTC

Help getting the current AuthorizationInfo from the Subject

Hey guys,
  Our application has it's own custom AuthorizationInfo, and we've
subclassed SimpleAuthroizationInfo with this class.  We need the
organization and application info as part of the authorization.

https://github.com/apigee/usergrid-stack/blob/USERGRID-2335/services/src/main/java/org/usergrid/security/shiro/auth/UsergridAuthorizationInfo.java


For some calls, I need to get the current Subject's instance of the
UsergridAuthrorizationInfo.  I know how to easily get the principals, but
it's not clear to me how I can get the AuthorizationInfo.  Creating the
instance of the UsergridAuthorizationInfo is quite expensive (A lot of back
and forth with cassandra) so I only want to do it once and then get it from
the cache.  I have the cache implemented and it works well.

I need to get the cached instanced from this method, I want to be sure I'm
not re-creating it.  Below is the utility method I'm trying to implement.
 The code is a bit of a mess, since I've been trying to figure out the
correct api call chain to do this.  If I can avoid doing any hard coding
into our classes and just use the framework, that would be ideal.  Any help
would be greatly appreciated!


https://github.com/apigee/usergrid-stack/blob/USERGRID-2335/services/src/main/java/org/usergrid/security/shiro/utils/SubjectUtils.java#L216



Thanks,
Todd

Re: Help getting the current AuthorizationInfo from the Subject

Posted by Todd Nine <tn...@apigee.com>.
Bump, anyone?  If there's a better approach I'm game.  I'm just not sure
how to do that with the cache. Having a cache add data to the current
Subject's session feels a bit hackish.


On Sat, Nov 9, 2013 at 11:24 AM, Todd Nine <tn...@apigee.com> wrote:

> Hey guys,
>   Our application has it's own custom AuthorizationInfo, and we've
> subclassed SimpleAuthroizationInfo with this class.  We need the
> organization and application info as part of the authorization.
>
>
> https://github.com/apigee/usergrid-stack/blob/USERGRID-2335/services/src/main/java/org/usergrid/security/shiro/auth/UsergridAuthorizationInfo.java
>
>
> For some calls, I need to get the current Subject's instance of the
> UsergridAuthrorizationInfo.  I know how to easily get the principals, but
> it's not clear to me how I can get the AuthorizationInfo.  Creating the
> instance of the UsergridAuthorizationInfo is quite expensive (A lot of back
> and forth with cassandra) so I only want to do it once and then get it from
> the cache.  I have the cache implemented and it works well.
>
> I need to get the cached instanced from this method, I want to be sure I'm
> not re-creating it.  Below is the utility method I'm trying to implement.
>  The code is a bit of a mess, since I've been trying to figure out the
> correct api call chain to do this.  If I can avoid doing any hard coding
> into our classes and just use the framework, that would be ideal.  Any help
> would be greatly appreciated!
>
>
>
> https://github.com/apigee/usergrid-stack/blob/USERGRID-2335/services/src/main/java/org/usergrid/security/shiro/utils/SubjectUtils.java#L216
>
>
>
> Thanks,
> Todd
>