private Task <IAccount> TryBearerAuthenticationAsync(IOwinEnvironment context, IClient client) { var bearerHeaderParser = new BearerAuthenticationParser(context.Request.Headers.GetString("Authorization"), logger); if (!bearerHeaderParser.IsValid) { return(Task.FromResult <IAccount>(null)); } logger.Info("Using Bearer header to authenticate request", nameof(TryBearerAuthenticationAsync)); return(ValidateAccessTokenAsync(context, client, bearerHeaderParser.Token)); }
private async Task RevokeHeaderToken(IOwinEnvironment context, IClient client, CancellationToken cancellationToken) { var bearerHeaderParser = new BearerAuthenticationParser(context.Request.Headers.GetString("Authorization"), _logger); if (!bearerHeaderParser.IsValid) { return; } var revoker = new TokenRevoker(client, _logger) .AddToken(bearerHeaderParser.Token); try { await revoker.Revoke(cancellationToken); } catch (Exception ex) { _logger.Info(ex.Message, source: nameof(RevokeCookieTokens)); } }