Update the documentation pages

This commit is contained in:
OpenIddict Bot 2021-01-25 17:47:01 +00:00
parent 036d584a7b
commit 928c228ad8
2 changed files with 11 additions and 7 deletions

View File

@ -79,9 +79,9 @@ and explicitly attached to a <code>ClaimsPrincipal</code> using the OpenIddict-s
For that, a &quot;consent type&quot; can be defined per-application, as in the following example:</p> For that, a &quot;consent type&quot; can be defined per-application, as in the following example:</p>
<pre><code class="lang-csharp">// Retrieve the application details from the database. <pre><code class="lang-csharp">// Retrieve the application details from the database.
var application = await _applicationManager.FindByClientIdAsync(request.ClientId) ?? var application = await _applicationManager.FindByClientIdAsync(request.ClientId) ??
throw new InvalidOperationException(&quot;Details concerning the calling client application cannot be found.&quot;); throw new InvalidOperationException(&quot;The application cannot be found.&quot;);
// Retrieve the permanent authorizations associated with the user and the calling client application. // Retrieve the permanent authorizations associated with the user and the application.
var authorizations = await _authorizationManager.FindAsync( var authorizations = await _authorizationManager.FindAsync(
subject: await _userManager.GetUserIdAsync(user), subject: await _userManager.GetUserIdAsync(user),
client : await _applicationManager.GetIdAsync(application), client : await _applicationManager.GetIdAsync(application),
@ -98,7 +98,8 @@ switch (await _applicationManager.GetConsentTypeAsync(application))
authenticationSchemes: OpenIddictServerAspNetCoreDefaults.AuthenticationScheme, authenticationSchemes: OpenIddictServerAspNetCoreDefaults.AuthenticationScheme,
properties: new AuthenticationProperties(new Dictionary&lt;string, string&gt; properties: new AuthenticationProperties(new Dictionary&lt;string, string&gt;
{ {
[OpenIddictServerAspNetCoreConstants.Properties.Error] = Errors.ConsentRequired, [OpenIddictServerAspNetCoreConstants.Properties.Error] =
Errors.ConsentRequired,
[OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = [OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] =
&quot;The logged in user is not allowed to access this client application.&quot; &quot;The logged in user is not allowed to access this client application.&quot;
})); }));
@ -107,14 +108,16 @@ switch (await _applicationManager.GetConsentTypeAsync(application))
// return an authorization response without displaying the consent form. // return an authorization response without displaying the consent form.
case ConsentTypes.Implicit: case ConsentTypes.Implicit:
case ConsentTypes.External when authorizations.Any(): case ConsentTypes.External when authorizations.Any():
case ConsentTypes.Explicit when authorizations.Any() &amp;&amp; !request.HasPrompt(Prompts.Consent): case ConsentTypes.Explicit when authorizations.Any() &amp;&amp;
!request.HasPrompt(Prompts.Consent):
var principal = await _signInManager.CreateUserPrincipalAsync(user); var principal = await _signInManager.CreateUserPrincipalAsync(user);
// Note: in this sample, the granted scopes match the requested scope // Note: in this sample, the granted scopes match the requested scope
// but you may want to allow the user to uncheck specific scopes. // but you may want to allow the user to uncheck specific scopes.
// For that, simply restrict the list of scopes before calling SetScopes. // For that, simply restrict the list of scopes before calling SetScopes.
principal.SetScopes(request.GetScopes()); principal.SetScopes(request.GetScopes());
principal.SetResources(await _scopeManager.ListResourcesAsync(principal.GetScopes()).ToListAsync()); principal.SetResources(await _scopeManager.ListResourcesAsync(
principal.GetScopes()).ToListAsync());
// Automatically create a permanent authorization to avoid requiring explicit consent // Automatically create a permanent authorization to avoid requiring explicit consent
// for future authorization or token requests containing the same scopes. // for future authorization or token requests containing the same scopes.
@ -146,7 +149,8 @@ switch (await _applicationManager.GetConsentTypeAsync(application))
authenticationSchemes: OpenIddictServerAspNetCoreDefaults.AuthenticationScheme, authenticationSchemes: OpenIddictServerAspNetCoreDefaults.AuthenticationScheme,
properties: new AuthenticationProperties(new Dictionary&lt;string, string&gt; properties: new AuthenticationProperties(new Dictionary&lt;string, string&gt;
{ {
[OpenIddictServerAspNetCoreConstants.Properties.Error] = Errors.ConsentRequired, [OpenIddictServerAspNetCoreConstants.Properties.Error] =
Errors.ConsentRequired,
[OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] = [OpenIddictServerAspNetCoreConstants.Properties.ErrorDescription] =
&quot;Interactive user consent is required.&quot; &quot;Interactive user consent is required.&quot;
})); }));

View File

@ -9861,7 +9861,7 @@
"output": { "output": {
".html": { ".html": {
"relative_path": "configuration/authorization-storage.html", "relative_path": "configuration/authorization-storage.html",
"hash": "u/HsIJFZPle5GhsRMjBbeA==" "hash": "OFSAAR/675OwAhhWVsS24w=="
} }
}, },
"is_incremental": false, "is_incremental": false,