Class AuthorizeResponseGenerator
- Namespace
- Fdyay.IdentityServer.ResponseHandling
- Assembly
- Fdyay.IdentityServer.AspNetCore.dll
Duende's default authorize response generator: the authorization code flow.
public class AuthorizeResponseGenerator : IAuthorizeResponseGenerator
- Inheritance
-
AuthorizeResponseGenerator
- Implements
- Inherited Members
Remarks
Open, as Duende's is: derive from it and register the derived type as IAuthorizeResponseGenerator to change one step — CreateCodeFlowResponseAsync(ValidatedAuthorizeRequest, CancellationToken) to add to the answer (its CustomParameters), CreateCodeAsync(ValidatedAuthorizeRequest, CancellationToken) to change the code before it is stored. Duende's implicit and hybrid steps are not here: those flows are non-goals.
Constructors
AuthorizeResponseGenerator(IAuthorizationCodeStore, IUserSession, ISessionStateService, IIssuerNameService, TimeProvider, ILogger<AuthorizeResponseGenerator>)
Creates the generator, as the container resolves it.
public AuthorizeResponseGenerator(IAuthorizationCodeStore authorizationCodeStore, IUserSession userSession, ISessionStateService sessionStateService, IIssuerNameService issuerNameService, TimeProvider timeProvider, ILogger<AuthorizeResponseGenerator> logger)
Parameters
authorizationCodeStoreIAuthorizationCodeStoreWhere the issued authorization code is stored.
userSessionIUserSessionThe user's session, asked for its id when the request carries none.
sessionStateServiceISessionStateServiceComputes the response's
session_state.issuerNameServiceIIssuerNameServiceNames this server as the response's
iss.timeProviderTimeProviderThe clock that stamps the code's creation time.
loggerILogger<AuthorizeResponseGenerator>Receives the generator's diagnostics.
Properties
AuthorizationCodeStore
Where the issued authorization code is stored.
protected IAuthorizationCodeStore AuthorizationCodeStore { get; }
Property Value
IssuerNameService
Names this server as the response's iss (RFC 9207).
protected IIssuerNameService IssuerNameService { get; }
Property Value
Logger
Receives the generator's diagnostics.
protected ILogger Logger { get; }
Property Value
SessionStateService
Computes the response's session_state for the check-session iframe.
protected ISessionStateService SessionStateService { get; }
Property Value
TimeProvider
The clock that stamps the code's creation time.
protected TimeProvider TimeProvider { get; }
Property Value
UserSession
Where the session id comes from. Duende's request carries it; this server's asks the session.
protected IUserSession UserSession { get; }
Property Value
Methods
CreateCodeAsync(ValidatedAuthorizeRequest, CancellationToken)
The code for this request, before it is stored. Duende's.
protected virtual Task<AuthorizationCode> CreateCodeAsync(ValidatedAuthorizeRequest request, CancellationToken ct)
Parameters
requestValidatedAuthorizeRequestctCancellationToken
Returns
Remarks
What was granted, not what was asked for: the request's scopes, which the interaction generator has narrowed to what
the user just consented to — so the consent screen's per-scope control is a decision, not a display. Duende reads
ValidatedResources.RawScopeValues.
Ours: the subject's claims are carried on the code rather than the principal, and its id is sub, else the name
identifier. Duende also sets StateHash (EmitStateHash) and WasConsentShown, which this server's
code does not have.
CreateCodeFlowResponseAsync(ValidatedAuthorizeRequest, CancellationToken)
Creates the code, stores it, and answers with its handle. Duende's.
protected virtual Task<AuthorizeResponse> CreateCodeFlowResponseAsync(ValidatedAuthorizeRequest request, CancellationToken ct)
Parameters
requestValidatedAuthorizeRequestctCancellationToken
Returns
Remarks
Duende 8.0.1's, measured: the issuer, the request, the code and the session state. The session state is Session Management 1.0 §3's, null when there is no session to report on, and then not sent.
CreateResponseAsync(ValidatedAuthorizeRequest, CancellationToken)
public virtual Task<AuthorizeResponse> CreateResponseAsync(ValidatedAuthorizeRequest request, CancellationToken ct)
Parameters
requestValidatedAuthorizeRequestctCancellationToken
Returns
Remarks
Duende 8.0.1's, measured: the flow is chosen by the request and one this generator does not know is a programming
error, not a refusal. Duende's chooses by grant type among three flows; this server's validator admits only
response_type=code.