Class QueryAuthProvider<TModel, TUser>
Auth provider that uses query parameter authentication to authorize the user
Implements
IAuthProvider<TModel, TUser>
Namespace: Seltzr.Auth
Assembly: Seltzr.dll
Syntax
C#
public class QueryAuthProvider<TModel, TUser> : IAuthProvider<TModel, TUser> where TModel : class where TUser : class
Type Parameters
TModel
The type of model that this API handles
TUser
The type of the authenticated user context
Constructors
Initializes a new instance of the QueryAuthProvider<TModel, TUser> class.
C#
public QueryAuthProvider(string parameterName, Func<string, Task<TUser>> authDelegate)
Parameters
parameterName
String
The name of the query parameter containing the API key
Methods
Authenticates the given request context, and returns the authenticated user
C#
public virtual Task<TUser> AuthenticateAsync(IApiContext<TModel, TUser> context)
Parameters
context
IApiContext<TModel, TUser>
The current API context
Returns
Task<TUser>
The currently authenticated user context
Gets whether or not the given request can be authenticated for
C#
public virtual Task<bool> CanAuthAsync(IApiContext<TModel, TUser> context)
Parameters
context
IApiContext<TModel, TUser>
The current API context
Returns
true if this request contains the query parameter this IAuthProvider<TModel, TUser> authenticates with, false otherwise.