public async Task <IHttpActionResult> Post([FromBody] CreateAuthenticator command) { await _CommandDispatcher.DispatchAsync(command); var authenticator = await _authenService.GetAsync(command.Tag); return(Created($"api/authenticators/{command.Tag}", authenticator)); }
/// <summary> /// The delegate passed in will be used to construct IAuthenticators in multiple contexts. If /// you do not construct a new IAuthenticator on each call please ensure you are fetching old ones from /// the correct location. /// </summary> /// <example> /// <code> /// AuthenticatorFactory.GetInstance().RegisterAuthenticator(() => new YourAuthenticator()); /// AuthenticatorFactory.GetInstance().RegisterAuthenticator(delegate(){return new YourAuthenticator()}); /// </code> /// </example> public void RegisterAuthenticator(CreateAuthenticator authenticatorCreator) { if (authenticatorCreator == null) { throw new ArgumentNullException("authenticatorCreator"); } this.authenticatorCreator = authenticatorCreator; }