Table of Contents

Interface IIdentityServerInteractionService

Namespace
Fdyay.IdentityServer.Services
Assembly
Fdyay.IdentityServer.AspNetCore.dll

Surfaces protocol request context to the interactive UI (login, consent, logout).

public interface IIdentityServerInteractionService

Methods

CreateLogoutContextAsync(CancellationToken)

Captures the current signed-in session as a logout id, or null when nobody is signed in.

Task<string?> CreateLogoutContextAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task<string>

DenyAuthenticationAsync(IAuthenticationContext, InteractionError, CancellationToken, string?)

Records a denial of any pending request, to be returned to the client as an error.

[SuppressMessage("Design", "CA1068:CancellationToken parameters must come last", Justification = "A parameter's position is part of the signature a host compiles against, and this order is the one existing hosts were written to.")]
Task DenyAuthenticationAsync(IAuthenticationContext context, InteractionError interactionError, CancellationToken cancellationToken = default, string? errorDescription = null)

Parameters

context IAuthenticationContext
interactionError InteractionError
cancellationToken CancellationToken
errorDescription string

Returns

Task

DenyAuthorizationAsync(AuthorizationRequest, InteractionError, CancellationToken, string?)

Records a denial of a pending authorization request, to be returned to the client as an error.

[SuppressMessage("Design", "CA1068:CancellationToken parameters must come last", Justification = "A parameter's position is part of the signature a host compiles against, and this order is the one existing hosts were written to.")]
Task DenyAuthorizationAsync(AuthorizationRequest request, InteractionError interactionError, CancellationToken cancellationToken = default, string? errorDescription = null)

Parameters

request AuthorizationRequest
interactionError InteractionError
cancellationToken CancellationToken
errorDescription string

Returns

Task

GetAllUserGrantsAsync(CancellationToken)

The consent the signed-in user has given, for an account-management screen.

Task<IReadOnlyCollection<Grant>> GetAllUserGrantsAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task<IReadOnlyCollection<Grant>>

GetAuthenticationContextAsync(string?, CancellationToken)

Gets the pending request described by a return URL, whatever kind it is.

Task<IAuthenticationContext?> GetAuthenticationContextAsync(string? returnUrl, CancellationToken cancellationToken = default)

Parameters

returnUrl string
cancellationToken CancellationToken

Returns

Task<IAuthenticationContext>

GetAuthorizationContextAsync(string?, CancellationToken)

Gets the authorization request described by a return URL, or null if it is not valid.

Task<AuthorizationRequest?> GetAuthorizationContextAsync(string? returnUrl, CancellationToken cancellationToken = default)

Parameters

returnUrl string
cancellationToken CancellationToken

Returns

Task<AuthorizationRequest>

GetErrorContextAsync(string?, CancellationToken)

Gets the error context identified by errorId.

Task<ErrorMessage?> GetErrorContextAsync(string? errorId, CancellationToken cancellationToken = default)

Parameters

errorId string
cancellationToken CancellationToken

Returns

Task<ErrorMessage>

Null when the id is absent, unknown, or has expired.

GetLogoutContextAsync(string?, CancellationToken)

Gets the signout request identified by logoutId.

Task<LogoutRequest> GetLogoutContextAsync(string? logoutId, CancellationToken cancellationToken = default)

Parameters

logoutId string
cancellationToken CancellationToken

Returns

Task<LogoutRequest>

Remarks

An absent or unreadable id yields a context that prompts the user to confirm.

GrantConsentAsync(AuthorizationRequest, ConsentResponse, CancellationToken, string?)

Records the user's decision on a pending authorization request.

[SuppressMessage("Design", "CA1068:CancellationToken parameters must come last", Justification = "A parameter's position is part of the signature a host compiles against, and this order is the one existing hosts were written to.")]
Task GrantConsentAsync(AuthorizationRequest request, ConsentResponse consent, CancellationToken cancellationToken = default, string? subject = null)

Parameters

request AuthorizationRequest
consent ConsentResponse
cancellationToken CancellationToken
subject string

Returns

Task

IsValidReturnUrl(string?)

Whether the return URL is a valid local authorize URL.

bool IsValidReturnUrl(string? returnUrl)

Parameters

returnUrl string

Returns

bool

RevokeTokensForCurrentSessionAsync(CancellationToken)

Removes the tokens issued for the signed-in user's current session.

Task RevokeTokensForCurrentSessionAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task

RevokeUserConsentAsync(string?, CancellationToken)

Withdraws the signed-in user's consent for a client.

Task RevokeUserConsentAsync(string? clientId, CancellationToken cancellationToken = default)

Parameters

clientId string
cancellationToken CancellationToken

Returns

Task

Remarks

Consent alone: the tokens already issued under it are removed too, because leaving them would let a client the user has just disconnected keep acting on their behalf until those tokens expired.