public async Task Can_retrieve_the_Request_Token() { var response = await _flowHelper.GetRequestToken(_account); response.Should().NotBeNull(); response.Error.Should().BeNull(); }
private async Task <bool> BeValid(string token, CancellationToken cancellationToken) { var requestToken = new RequestToken { Key = token }; var encryptedToken = await _encryptionProvider.Encrypt <RequestToken, Domains.Data.RequestToken>(requestToken); encryptedToken = await _requestTokenService.GetRequestToken(encryptedToken.Key, cancellationToken); return(encryptedToken != null); }
public async Task <ValidateTokenResponse> Handle(ValidateTokenRequest request, CancellationToken cancellationToken) { var requestToken = new RequestToken { Key = request.Token }; var encryptedToken = await _encryptionProvider.Encrypt <RequestToken, Domains.Data.RequestToken>(requestToken); encryptedToken = await _requestTokenService.GetRequestToken(encryptedToken.Key, cancellationToken); encryptedToken.Expires = _clockProvider.DateTimeOffset; await _requestTokenService.SaveRequestToken(encryptedToken, cancellationToken); return(new ValidateTokenResponse { IsSuccessful = true }); }
public async Task <ActionResult <RequestTokenResponse> > RequestToken(string account) { var response = await _requestTokenService.GetRequestToken(account); return((response.Error == null) ? Ok(response) : StatusCode((int)response.Error.StatusCode, response)); }