-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refact: return detailed error messages for WebApi integration #105
Conversation
error: exception.Error.ToString(), | ||
errorDescription: exception.ErrorDescription | ||
); | ||
string authenticateHeader = $"Bearer error=\"{ responseContent.Error }\", error_description=\"{ responseContent.ErrorDescription }\""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is sketch
@@ -57,5 +94,12 @@ public abstract class OAuth2AuthorizeAttribute : AuthorizeAttribute { | |||
|
|||
protected abstract bool IsAuthorizedInternal( HttpActionContext actionContext ); | |||
|
|||
private static void HandleNoAuth( HttpActionContext actionContext ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: verify this occurs and it's not just a different code path doing No-Auth 401s
@@ -24,7 +24,7 @@ await TestUtilities.RunBasicAuthTest( "/authorization/unspecifiedprincipaltype", | |||
|
|||
|
|||
[Test] | |||
public async Task Basic_NoAuthentication_403() { | |||
public async Task Basic_NoAuthentication_401() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
~unrelated
await TestUtilities | ||
.RunBasicAuthTest( "/authorization/imp", jwt, HttpStatusCode.Forbidden ) | ||
var response = await TestUtilities | ||
.RunBasicAuthTest<OAuth2ErrorResponse>( "/authorization/imp", jwt, HttpStatusCode.Unauthorized ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed these cause of the RFC suggestion, and I didn't think it super terribly mattered.
invalid_token
The access token provided is expired, revoked, malformed, or
invalid for other reasons. The resource SHOULD respond with
the HTTP 401 (Unauthorized) status code. The client MAY
request a new access token and retry the protected resource
request.
900cc5c
to
1a9979f
Compare
1a9979f
to
2bccfda
Compare
We're going to deprecate the WebAPI library because it is incompatible with ASP.NET Core. |
Closes: #40