Browse Source

Relax the authorization request validation policy to allow confidential clients to partially use the hybrid flow

pull/183/head
Kévin Chalet 10 years ago
parent
commit
ce61ab5779
  1. 14
      src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Authentication.cs

14
src/OpenIddict.Core/Infrastructure/OpenIddictProvider.Authentication.cs

@ -243,14 +243,16 @@ namespace OpenIddict.Infrastructure {
return; return;
} }
// To prevent downgrade attacks, ensure that authorization requests using the hybrid/implicit // To prevent downgrade attacks, ensure that authorization requests returning an access token directly
// flow are rejected if the client identifier corresponds to a confidential application. // from the authorization endpoint are rejected if the client_id corresponds to a confidential application.
// Note: when using the authorization code grant, ValidateTokenRequest is responsible of // Note: when using the authorization code grant, ValidateTokenRequest is responsible of rejecting
// rejecting the token request if the client_id corresponds to an unauthenticated confidential client. // the token request if the client_id corresponds to an unauthenticated confidential client.
if (await services.Applications.IsPublicAsync(application) && !context.Request.IsAuthorizationCodeFlow()) { if (await services.Applications.IsConfidentialAsync(application) &&
context.Request.HasResponseType(OpenIdConnectConstants.ResponseTypes.Token)) {
context.Reject( context.Reject(
error: OpenIdConnectConstants.Errors.InvalidRequest, error: OpenIdConnectConstants.Errors.InvalidRequest,
description: "Confidential clients can only use response_type=code."); description: "Confidential clients are not allowed to retrieve " +
"an access token from the authorization endpoint.");
return; return;
} }

Loading…
Cancel
Save