public override void OnRegistered(IRequest httpReq, IAuthSession session, IServiceBase registrationService) { var apiKeys = apiKeyProvider.GenerateNewApiKeys(session.UserAuthId); var authRepo = (IManageApiKeys)httpReq.TryResolve <IAuthRepository>().AsUserAuthRepository(httpReq); authRepo.StoreAll(apiKeys); }
public override void OnRegistered(IRequest httpReq, IAuthSession session, IServiceBase registrationService) { var apiKeys = apiKeyProvider.GenerateNewApiKeys(session.UserAuthId); var authRepo = (IManageApiKeys)HostContext.AppHost.GetAuthRepository(httpReq); using (authRepo as IDisposable) { authRepo.StoreAll(apiKeys); } }
public override async Task OnRegisteredAsync(IRequest httpReq, IAuthSession session, IServiceBase registrationService, CancellationToken token = default) { var apiKeys = apiKeyProvider.GenerateNewApiKeys(session.UserAuthId); var manageApiKeys = HostContext.AppHost.AssertManageApiKeysAsync(httpReq); using (manageApiKeys as IDisposable) { await manageApiKeys.StoreAllAsync(apiKeys, token).ConfigAwait(); } }