public DocumentationTokensProvider(IContentManager contentManager, ITokenEncoder tokenEncoder) { _contentManager = contentManager; _tokenEncoder = tokenEncoder; T = NullLocalizer.Instance; }
public AuthenticationModule( ICommandSender commandSender, ITokenEncoder tokenEncoder, IQueryProcessor queryProcessor) { Post("/api/register", async _ => { var command = this.Bind <RegisterUserCommand>(); await commandSender.Send(command); var token = new JwtPayload(command.UserId); return(Negotiate .WithStatusCode(HttpStatusCode.OK) .WithModel(new { token = tokenEncoder.Encode(token), expire = token.Expire })); }); Post("/api/login", async _ => { var userId = this.Request.Form.UserId; if (string.IsNullOrEmpty(userId)) { return(Negotiate.WithStatusCode(HttpStatusCode.Unauthorized)); } var user = await queryProcessor.Query(new FindUserQuery(userId)); if (user == null) { return(Negotiate.WithStatusCode(HttpStatusCode.Unauthorized)); } var token = new JwtPayload(userId); return(Negotiate .WithStatusCode(HttpStatusCode.OK) .WithModel(new { token = tokenEncoder.Encode(token), expire = token.Expire })); }); }
public EndpointTokensProvider(IContentManager contentManager, ITokenEncoder tokenEncoder) : base(contentManager, tokenEncoder) { }
public EntityFieldTokensProvider(IContentManager contentManager, ITokenEncoder tokenEncoder) : base(contentManager, tokenEncoder) { }
public JwtTokenValidator(ITokenEncoder tokenGenerator, IQueryProcessor queryProcessor) { this.tokenGenerator = tokenGenerator; this.queryProcessor = queryProcessor; }
public EntityDefinitionTokensProvider(IContentManager contentManager, ITokenEncoder tokenEncoder) : base(contentManager, tokenEncoder) { }
public TokenAlgorithm(TokenHashSettings settings, ITokenEncoder backpack) { _settings = settings ?? TokenHashSettings.SHA256; _backpack = backpack ?? throw new ArgumentNullException(nameof(backpack)); }
public AuthenticateService(IUnitOfWork uow, IMediator bus, INotificationHandler <DomainNotification> notifications, IUserRepository userRepository, ITokenEncoder tokenEncoder) : base(uow, bus, notifications) { _userRepository = userRepository; _tokenEncoder = tokenEncoder; }
public ErrorResultTokensProvider(IContentManager contentManager, ITokenEncoder tokenEncoder) : base(contentManager, tokenEncoder) { }