Skip to content

Instantly share code, notes, and snippets.

@nukedbit
Created August 11, 2022 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nukedbit/9f6723cf0680abf408c12e6c3972be0e to your computer and use it in GitHub Desktop.
Save nukedbit/9f6723cf0680abf408c12e6c3972be0e to your computer and use it in GitHub Desktop.
ServiceStack login meta
class CustomCredentialProvider: CredentialsAuthProvider,IAuthResponseFilter
{
public CustomCredentialProvider(IAppSettings appSettings):base(appSettings)
{
}
public async Task ExecuteAsync(AuthFilterContext authContext)
{
var db = HostContext.AppHost.GetDbConnection(authContext.Request);
var userId = Convert.ToInt32(authContext.Session.UserAuthId);
var user = await db.SingleAsync<sstestauth.AppUser>(x => x.Id == userId);
authContext.AuthResponse.Meta = user.Meta;
}
public Task ResultFilterAsync(AuthResultContext authContext, CancellationToken token = new CancellationToken())
{
throw new NotImplementedException();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment