Show / Hide Table of Contents

Class BasicAuthProvider<TModel, TUser>

Auth provider that uses basic authentication to authorize the user

Inheritance
Object
BasicAuthProvider<TModel, TUser>
Implements
IAuthProvider<TModel, TUser>
Namespace: Seltzr.Auth
Assembly: Seltzr.dll
Syntax
C#
public class BasicAuthProvider<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

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

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

C#
public BasicAuthProvider(Func<string, string, Task<TUser>> authDelegate)
Parameters
authDelegateFunc<String, String, Task<TUser>>

The delegate that, when called with the decoded username and password, will return a reference to an authenticated user context, or throw if the credentials are 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 an Authorization header that starts with "Basic", false otherwise.

Implements

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