AuthCookieProvider

Namespace: ASPSecurityKit.AuthProviders
Assembly: ASPSecurityKit.dll

Summary

Implements IAuthCookieProvider to create auth cookie.

Remarks

The auth cookie has the name as defined by Cookie. The format for auth cookie value is [idTokenType]:[idToken]:[authUrnHash]. The hash is computed using authUrn [idTokenType]:[idToken] as input and HMACSHA256 as the hash provider. To learn more about this scheme, visit https://ASPSecurityKit.net/docs/authentication-schemes/#auth-cookie

Constructors

#ctor(settings)

Summary

Initializes a new instance of the AuthCookieProvider class.

Parameters
Name Type Description
settings ASPSecurityKit.ISecuritySettings The security settings.

Methods

CreateAuthCookie(authUrn,secret,persist,options)

Summary

Creates an auth cookie signed with the specified authUrn using the specified options.

Returns

The auth cookie signed with the specified authUrn.

Parameters
Name Type Description
authUrn System.String The identity token [idTokenType]:[idToken].
secret System.String The secret associated with the identity token to compute the signature hash.
persist System.Boolean Indicates whether to create a long-lived cookie; if so, the ExpiresIn will be added to UtcNow.
options ASPSecurityKit.CookieOptions The cookie options. If not specified, the default options as specified by AuthCookieOptions will be used instead.
Exceptions
Type Description
System.ArgumentNullException When authUrn/secret is null/whitespace.

CreateAuthCookieAsync(authUrn,secret,persist,options)

Summary

Creates an auth cookie signed with the specified authUrn using the specified options.

Returns

The auth cookie signed with the specified authUrn.

Parameters
Name Type Description
authUrn System.String The identity token [idTokenType]:[idToken].
secret System.String The secret associated with the identity token to compute the signature hash.
persist System.Boolean Indicates whether to create a long-lived cookie; if so, the ExpiresIn will be added to UtcNow.
options ASPSecurityKit.CookieOptions The cookie options. If not specified, the default options as specified by AuthCookieOptions will be used instead.
Exceptions
Type Description
System.ArgumentNullException When authUrn/secret is null/whitespace.

CreateAuthCookieAsync(authUrn,secret,cancellationToken,persist,options)

Summary

Creates an auth cookie signed with the specified authUrn using the specified options.

Returns

The auth cookie signed with the specified authUrn.

Parameters
Name Type Description
authUrn System.String The identity token [idTokenType]:[idToken].
secret System.String The secret associated with the identity token to compute the signature hash.
cancellationToken System.Threading.CancellationToken The cancellation token.
persist System.Boolean Indicates whether to create a long-lived cookie; if so, the ExpiresIn will be added to UtcNow.
options ASPSecurityKit.CookieOptions The cookie options. If not specified, the default options as specified by AuthCookieOptions will be used instead.
Exceptions
Type Description
System.ArgumentNullException When authUrn/secret is null/whitespace.