Table of Contents

Class TokenResult<T>

Namespace
Fdyay.AccessTokenManagement
Assembly
Fdyay.AccessTokenManagement.OpenIdConnect.dll

A token, or the reason there is none.

public sealed class TokenResult<T> where T : class

Type Parameters

T
Inheritance
TokenResult<T>
Inherited Members

Remarks

The expected failures — no signed-in user, a refresh token the authorization server has revoked — come back as a value rather than an exception, because for a BFF they are ordinary: a session ends, a membership is removed. GetToken<T>(Task<TokenResult<T>>) turns one into an exception for a caller that would rather catch.

Properties

FailedResult

Why there is no token, when there is none.

public FailedResult? FailedResult { get; }

Property Value

FailedResult

Succeeded

Whether there is a token: true when Token is set, false when FailedResult is.

[MemberNotNullWhen(true, "Token")]
[MemberNotNullWhen(false, "FailedResult")]
public bool Succeeded { get; }

Property Value

bool

Token

The token, when there is one.

public T? Token { get; }

Property Value

T

Operators

implicit operator TokenResult<T>(FailedResult)

A failed result carrying failedResult.

public static implicit operator TokenResult<T>(FailedResult failedResult)

Parameters

failedResult FailedResult

Why there is no token.

Returns

TokenResult<T>

A result whose Succeeded is false.

Exceptions

ArgumentNullException

failedResult is null.

implicit operator TokenResult<T>(T)

A successful result carrying token.

public static implicit operator TokenResult<T>(T token)

Parameters

token T

The token.

Returns

TokenResult<T>

A result whose Succeeded is true.

Exceptions

ArgumentNullException

token is null.