Skip to content

Instantly share code, notes, and snippets.

@brunomlopes
Created January 23, 2014 15:00
Show Gist options
  • Save brunomlopes/8579920 to your computer and use it in GitHub Desktop.
Save brunomlopes/8579920 to your computer and use it in GitHub Desktop.
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