The Subject is not intended to be extended like that. Generally, the extra data 
you want to add would be included in the Subject's PrincipalCollection.

 

If the field name, industry, etc. for the user data that backs the Subject is 
in the database, you might consider including just a unique identifier such as 
a database primary key in the PrincipalCollection and then when information 
like industry, title, etc. is needed you would use the primary key to load that 
data.

 

For example, in our system, we have an Account object which has additional 
information about a user. Our Realm implementation stores the Account's primary 
key ID as the first value in the PrincipalCollection. This keeps our principals 
lean, which is beneficial since they will often be cached/serialized. When a 
call to the system needs additional user information, like name or e-mail 
address, we use the primary principal (which, again, is the Account's primary 
key ID) to load the Account and access that information.

 

Hope this helps,

Bryan Turner

Katasoft, Inc.
 


> Date: Fri, 30 Sep 2011 11:32:16 -0700
> From: [email protected]
> To: [email protected]
> Subject: How to include aditional fields in Authenticated User?
> 
> How can I include additional fields in the Subject object of Shiro?
> 
> I need the field name, industry, title, among others.
> 
> Can anyone help me?
> 
> Thank you.
> 
> 
> --
> View this message in context: 
> http://shiro-user.582556.n2.nabble.com/How-to-include-aditional-fields-in-Authenticated-User-tp6848837p6848837.html
> Sent from the Shiro User mailing list archive at Nabble.com.                  
>                   

Reply via email to