/// <summary> /// Returns the current token value from the current HTTP request matching the "Authorization" key. /// If not found, returns an empty optional. /// </summary> public static Optional <string> GetRequestHttpToken(this IHttpRequestTokenAccessor tokenAccessor) { if (tokenAccessor is null) { throw new ArgumentNullException(nameof(tokenAccessor)); } return(tokenAccessor.GetRequestHttpToken("Authorization")); }
/// <summary> /// Initializes a new instance of <see cref="HttpAuthorizationTokenHandler"/> with the token accessor. /// </summary> /// <param name="httpRequestTokenAccessor">The token accessor to act with.</param> /// <exception cref="ArgumentNullException">The <paramref name="httpRequestTokenAccessor"/> is null.</exception> public HttpAuthorizationTokenHandler(IHttpRequestTokenAccessor httpRequestTokenAccessor) { _httpRequestTokenAccessor = httpRequestTokenAccessor ?? throw new ArgumentNullException(nameof(httpRequestTokenAccessor)); }
/// <summary> /// Initializes a new instance of <see cref="SecurityUserProvider"/> with specified arguments. /// </summary> /// <param name="httpRequestTokenAccessor">The token accessor instance.</param> /// <param name="tokenEngine">The token engine.</param> /// <exception cref="ArgumentNullException">The <paramref name="httpRequestTokenAccessor"/> is null.</exception> /// <exception cref="ArgumentNullException">The <paramref name="tokenEngine"/> is null.</exception> public SecurityUserProvider(IHttpRequestTokenAccessor httpRequestTokenAccessor, ITokenEngine tokenEngine) { _httpRequestTokenAccessor = httpRequestTokenAccessor ?? throw new ArgumentNullException(nameof(httpRequestTokenAccessor)); _tokenEngine = tokenEngine ?? throw new ArgumentNullException(nameof(tokenEngine)); }
/// <summary> /// Initializes a new instance of <see cref="HttpRequestUserClaimAccessor"/> with specified arguments. /// </summary> /// <param name="httpRequestTokenAccessor">The token accessor instance.</param> /// <param name="tokenEngine">The token engine.</param> /// <exception cref="ArgumentNullException">The <paramref name="httpRequestTokenAccessor"/> is null.</exception> /// <exception cref="ArgumentNullException">The <paramref name="tokenEngine"/> is null.</exception> public HttpRequestUserClaimAccessor(IHttpRequestTokenAccessor httpRequestTokenAccessor, ITokenEngine tokenEngine) { _httpRequestTokenAccessor = httpRequestTokenAccessor ?? throw new ArgumentNullException(nameof(httpRequestTokenAccessor)); _tokenEngine = tokenEngine ?? throw new ArgumentNullException(nameof(tokenEngine)); }