servicestackservicestack-auth

ServiceStack: AuthUser vs IAuthSession - how do I retrieve the AuthUser?


In previous Stack Overflow questions, @mythz tells about the Meta dictionary in the "UserAuth table".

However, I cannot find any information on where the UserAuth "table" is or where the object can be found. I am currently working with the IAuthSession, where I have some data regarding who is authenticated etc, but I cannot find info on where the UserAuth comes in.

I have read for example How can I extend ServiceStack Authentication but that doesn't help - I see no reference to an "AuthUser" object.

So, how does the AuthUser relate to the IAuthSession?


Solution

  • The UserAuth classes are used by the User Auth Repositories to persist information on the User. If you're not using an Auth Repository the UserAuth and UserAuthDetails are not used.

    E.g. For normal UserName/Password Credential Authentication, Registering the User (/register) will save their information in the UserAuth table. When they Authenticate (/auth/credentials) the registered IAuthRepository is used to validate their credentials against the UserName and PasswordHash stored in the UserAuth table, if successful the AuthProvider will populate the users AuthUserSession which is what's stored against the Session Cookie Ids to enable the Authenticated UserSession.