Class CookieAuth
static class for easy cookie based auth
Inherited Members
Namespace: FastEndpoints.Security
Assembly: FastEndpoints.Security.dll
Syntax
public static class CookieAuth
Methods
SignInAsync(Action<UserPrivileges>, Action<AuthenticationProperties>?)
creates the auth cookie and adds it to the current http response
Declaration
public static Task SignInAsync(Action<UserPrivileges> privileges, Action<AuthenticationProperties>? properties = null)
Parameters
Type | Name | Description |
---|---|---|
Action<UserPrivileges> | privileges | the privileges to be assigned to the user such as claims, permissions, and roles |
Action<AuthenticationProperties> | properties | an optional action to configure authentication properties |
Returns
Type | Description |
---|---|
Task |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | thrown if the auth middleware hasn't been configure or method is used outside the scope of an http request |
SignOutAsync(Action<AuthenticationProperties>?)
signs the user out from the cookie authentication scheme
Declaration
public static Task SignOutAsync(Action<AuthenticationProperties>? properties = null)
Parameters
Type | Name | Description |
---|---|---|
Action<AuthenticationProperties> | properties | an optional action to configure authentication properties |
Returns
Type | Description |
---|---|
Task |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | thrown if the auth middleware hasn't been configure or method is used outside the scope of an http request |