IdentityServer4 icon indicating copy to clipboard operation
IdentityServer4 copied to clipboard

Redirecting to the client on authorize validation errors (e.g. invalid scope)

Open acarlonvsn opened this issue 7 years ago • 3 comments

Is your feature request related to a problem? Please describe. The conditions under which IdentityServer4 redirects to a custom error page rather than the client seems to differ from what is documented on rfc6749.

Describe the solution you'd like Either of the following: -

  1. Redirect as defined in rfc6749.
  2. Customize which errors result in redirect to client.

Describe alternatives you've considered Instead of using a ProtectedDataMessageStore for error messages, a message store could be used that simply base64 encodes the error message. This would allow the calling server to intercept the response and redirect appropriately in a single step. What security vulnerabilities would this introduce?

Additional context For authorization code, rfc6749 indicates that certain errors should not result in a redirect back to the client (such as an invalid URL or client ID) whereas others such as invalid_scope should.

If the request fails due to a missing, invalid, or mismatching redirection URI, or if the client identifier is missing or invalid, the authorization server SHOULD inform the resource owner of the error and MUST NOT automatically redirect the user-agent to the invalid redirection URI.

If the resource owner denies the access request or if the request fails for reasons other than a missing or invalid redirection URI, the authorization server informs the client by adding the following parameters to the query component of the redirection URI

IdentityServer4 doesn't seem to follow this and instead redirects to a a self-hosted error page for all but access_denied. The relevant method is ProcessErrorAsync in AuthorizeResult.cs.

Also, the error messages are encrypted with IDataProvider.ProtectKey() which makes it onerous to intercept the response on the requesting server and redirect appropriately.

acarlonvsn avatar Feb 18 '19 05:02 acarlonvsn

We're following the additional guidance provided here: https://tools.ietf.org/html/draft-bradley-oauth-open-redirector-00#section-2

brockallen avatar Feb 18 '19 12:02 brockallen

Thanks, that explains it, we will modify our flow accordingly.

acarlonvsn avatar Feb 18 '19 21:02 acarlonvsn

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jan 11 '20 16:01 lock[bot]