public object Any(GetApiKeys request) { var apiKeyAuth = this.Request.AssertValidApiKeyRequest(); if (string.IsNullOrEmpty(request.Environment) && apiKeyAuth.Environments.Length != 1) { throw new ArgumentNullException("Environment"); } var env = request.Environment ?? apiKeyAuth.Environments[0]; var apiRepo = (IManageApiKeys)HostContext.AppHost.GetAuthRepository(base.Request); using (apiRepo as IDisposable) { return(new GetApiKeysResponse { Results = apiRepo.GetUserApiKeys(GetSession().UserAuthId) .Where(x => x.Environment == env) .Map(k => new UserApiKey { Key = k.Id, KeyType = k.KeyType, ExpiryDate = k.ExpiryDate, }) }); } }
public async Task <object> Any(GetApiKeys request) { var apiKeyAuth = this.Request.AssertValidApiKeyRequest(); if (string.IsNullOrEmpty(request.Environment) && apiKeyAuth.Environments.Length != 1) { throw new ArgumentNullException(nameof(request.Environment)); } var env = request.Environment ?? apiKeyAuth.Environments[0]; var manageApiKeys = HostContext.AppHost.AssertManageApiKeysAsync(Request); using (manageApiKeys as IDisposable) { var userId = (await GetSessionAsync().ConfigAwait()).UserAuthId; return(new GetApiKeysResponse { Results = (await manageApiKeys.GetUserApiKeysAsync(userId).ConfigAwait()) .Where(x => x.Environment == env) .Map(k => new UserApiKey { Key = k.Id, KeyType = k.KeyType, ExpiryDate = k.ExpiryDate, }) }); } }
public object Get(GetApiKeys request) { var result = _authRepo.Get(new AuthenticationInfoQuery { HasUser = false }); return(result); }
public object Get(GetApiKeys request) { var result = _authRepo.Get(new AuthenticationInfoQuery { IsActive = true }); return(ToOptimizedResult(result)); }
public object Any(GetApiKeys request) { var apiKeyAuth = this.Request.AssertValidApiKeyRequest(); if (string.IsNullOrEmpty(request.Environment) && apiKeyAuth.Environments.Length != 1) throw new ArgumentNullException("Environment"); var env = request.Environment ?? apiKeyAuth.Environments[0]; var apiRepo = (IManageApiKeys)HostContext.AppHost.GetAuthRepository(base.Request); using (apiRepo as IDisposable) { return new GetApiKeysResponse { Results = apiRepo.GetUserApiKeys(GetSession().UserAuthId) .Where(x => x.Environment == env) .Map(k => new UserApiKey { Key = k.Id, KeyType = k.KeyType, ExpiryDate = k.ExpiryDate, }) }; } }