Interface IIdentityProvider

Namespace
Cratis.Arc.Identity
Assembly
Cratis.Arc.Core.dll

Defines the system that handles IdentityProviderResult.

public interface IIdentityProvider
Extension Methods

Methods

Get()

Generates an IdentityProviderResult from the authenticated principal of the current HTTP context.

Task<IdentityProviderResult> Get()

Returns

Task<IdentityProviderResult>

The IdentityProviderResult.

Remarks

The identity is always derived from the authenticated request. Nothing the client sends besides its credentials, such as an identity cookie, is read.

Get<TDetails>()

Gets an IdentityProviderResult<TDetails> from the authenticated principal of the current HTTP context.

Task<IdentityProviderResult<TDetails>> Get<TDetails>()

Returns

Task<IdentityProviderResult<TDetails>>

The IdentityProviderResult<TDetails>.

Type Parameters

TDetails

Type of the details.

ModifyDetails<TDetails>(Func<TDetails, TDetails>)

Modifies the details of the current identity and writes the result to the response.

Task ModifyDetails<TDetails>(Func<TDetails, TDetails> details)

Parameters

details Func<TDetails, TDetails>

Function to modify the details.

Returns

Task

Awaitable task.

Type Parameters

TDetails

Type of the details.

Remarks

The modification applies to the current response only. It is not stored: the next request derives the identity from the authenticated principal again.

SetCookieForHttpResponse(IdentityProviderResult)

Writes the IdentityProviderResult to the response body as JSON, with headers that keep it out of shared caches.

Task SetCookieForHttpResponse(IdentityProviderResult result)

Parameters

result IdentityProviderResult

The IdentityProviderResult.

Returns

Task

Awaitable task.

Remarks

Despite its name, this no longer writes an identity cookie: it expires a .cratis-identity cookie written by an earlier version, if the request carries one. The name is kept for compatibility.