Created
January 23, 2014 15:00
-
-
Save brunomlopes/8579920 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Collections.Generic; | |
| using System.Diagnostics; | |
| using ServiceStack; | |
| using ServiceStack.Auth; | |
| namespace Test | |
| { | |
| public class CustomAuthUserSession : AuthUserSession | |
| { | |
| public string UserId { get; set; } | |
| public override void OnAuthenticated(IServiceBase authService, IAuthSession session, IAuthTokens tokens, Dictionary<string, string> authInfo) | |
| { | |
| base.OnAuthenticated(authService, session, tokens, authInfo); | |
| var service = authService.ResolveService<IUserAuthRepository>(); | |
| var userAuth = service.GetUserAuth(session, tokens); | |
| UserId = userAuth.RefIdStr; | |
| // we want to save after we set the custom fields | |
| authService.SaveSession(this, SessionFeature.DefaultSessionExpiry); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment