Show / Hide Table of Contents

Class QueryAuthProvider<TModel, TUser>

Auth provider that uses query parameter authentication to authorize the user

Inheritance
Object
QueryAuthProvider<TModel, TUser>
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

| Improve this Doc View Source

QueryAuthProvider(String, Func<String, Task<TUser>>)

Initializes a new instance of the QueryAuthProvider<TModel, TUser> class.

C#
public QueryAuthProvider(string parameterName, Func<string, Task<TUser>> authDelegate)
Parameters
parameterNameString

The name of the query parameter containing the API key

authDelegateFunc<String, Task<TUser>>

The delegate that, when called with the parameter value, will return a reference to an authenticated user context, or throw if the key is invalid

Methods

| Improve this Doc View Source

AuthenticateAsync(IApiContext<TModel, TUser>)

Authenticates the given request context, and returns the authenticated user

C#
public virtual Task<TUser> AuthenticateAsync(IApiContext<TModel, TUser> context)
Parameters
contextIApiContext<TModel, TUser>

The current API context

Returns

Task<TUser>

The currently authenticated user context

| Improve this Doc View Source

CanAuthAsync(IApiContext<TModel, TUser>)

Gets whether or not the given request can be authenticated for

C#
public virtual Task<bool> CanAuthAsync(IApiContext<TModel, TUser> context)
Parameters
contextIApiContext<TModel, TUser>

The current API context

Returns

Task<Boolean>

true if this request contains the query parameter this IAuthProvider<TModel, TUser> authenticates with, false otherwise.

Implements

IAuthProvider<TModel, TUser>
  • Improve this Doc
  • View Source
Back to top Generated by DocFX