gizmoboy
gizmoboy

Reputation: 260

Getting the UserAuth from a ServiceStack Session

During a basic or credentials authorization event, is there any place to get a handle on the UserAuth of the user being logged in in OnAuthenticated()?

We've extended the AuthSession object and would like to populate it with more data from the UserAuth (including projecting some custom fields out of the Meta).

I know we can load it ourselves by resolving the AuthRepo out of the authService, but I'm wondering if the current UserAuth is already available somewhere to keep us from spending those cycles needlessly.

Upvotes: 2

Views: 394

Answers (1)

Logic Labs
Logic Labs

Reputation: 404

If you're calling the base.OnAuthenticated() as the first call within your custom auths OnAuthenticated method then the session parameter will be populated with the UserAuth.

To persist it back though, you're going to need to resolve IAuthRepository and call IAuthRepository.SaveUserAuth(session).

Upvotes: 1

Related Questions