public ApiKeysModule(ICommandDispatcher commandDispatcher, IIdentityProvider identityProvider, IValidatorResolver validatorResolver, IApiKeyStorage apiKeyStorage) : base(commandDispatcher, validatorResolver, identityProvider, modulePath: "api-keys") { Get("", async args => await FetchCollection <BrowseApiKeys, ApiKey> (async x => await apiKeyStorage.BrowseAsync(x)) .MapTo(x => new { Name = x.Name, Key = x.Key }) .HandleAsync()); Get("{name}", async args => await Fetch <GetApiKey, ApiKey> (async x => await apiKeyStorage.GetAsync(x.UserId, x.Name)) .MapTo(x => new { Name = x.Name, Key = x.Key }) .HandleAsync()); Post("", async args => await For <RequestNewApiKey>() .OnSuccessAccepted("api-keys") .DispatchAsync()); Delete("{name}", async args => await For <DeleteApiKey>() .OnSuccess(HttpStatusCode.NoContent) .DispatchAsync()); }
public ApiKeysModule(ICommandDispatcher commandDispatcher, IIdentityProvider identityProvider, IApiKeyStorage apiKeyStorage) : base(commandDispatcher, identityProvider, modulePath: "api-keys") { Get("", async args => await FetchCollection <BrowseApiKeys, ApiKeyDto> (async x => await apiKeyStorage.BrowseAsync(x)).HandleAsync()); Post("", async args => await For <RequestNewApiKey>() .SetResourceId(x => x.ApiKeyId) .OnSuccessAccepted("api-keys/{0}") .DispatchAsync()); Delete("", async args => await For <DeleteApiKey>() .OnSuccess(HttpStatusCode.NoContent) .DispatchAsync()); }
public SynchronizeApiKeysTask(IApiKeyStorage apiKeyStorage, IIdentityProvider identityProvider) { _apiKeyStorage = apiKeyStorage; _identityProvider = identityProvider; }
public void UseStorage(IApiKeyStorage storage) { _storages.Add(storage ?? throw new ArgumentNullException(nameof(storage))); }
public ApiKeyCreatedHandler(IApiKeyStorage apiKeyStorage, IIdentityProvider identityProvider) { _apiKeyStorage = apiKeyStorage; _identityProvider = identityProvider; }