Search code examples
c#rhino-security

implementing rhino security where user Id data type is not long


i want to implement rhino security on my application. i have user entity class whose Id field is GUID.

according to Rhino security instructions i have to implement IUser interface which contains an id field which is long. now how can i implement IUSer interface without changing datatype of my user entity class


Solution

  • Where'd you see that? The IUser interface only requires implementors to expose a SecurityInfo property.

    IUser source

    I use Guids for my Ids and create a SecurityInfo object based on it

        public virtual SecurityInfo SecurityInfo
        {
            get
            {
                return new SecurityInfo(this.Username,this.Id);
            }
        }
    

    The first argument is the name of the user (it can be any string property) the second is your id which can be any object, including Guids.