Skip to content

Add OAuth error for client#2047

Merged
stevvooe merged 2 commits intodistribution:masterfrom
dmcgowan:fix-authorization-error
Nov 10, 2016
Merged

Add OAuth error for client#2047
stevvooe merged 2 commits intodistribution:masterfrom
dmcgowan:fix-authorization-error

Conversation

@dmcgowan
Copy link
Collaborator

@dmcgowan dmcgowan commented Nov 9, 2016

Allow clients to handle errors being set in the WWW-Authenticate rather than in the body. The WWW-Authenticate errors give a more precise error describing what is needed to authorize with the server. This allows clients to distinguish between 401s which require user login and 401s which are caused by insufficient scope.

// permission or invalid token given from a token server.
// See https://tools.ietf.org/html/rfc6750#section-3
type OAuthError struct {
ErrorCode string
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmcgowan dmcgowan force-pushed the fix-authorization-error branch 2 times, most recently from 18b35e3 to b9114cc Compare November 9, 2016 22:58
@dmcgowan
Copy link
Collaborator Author

dmcgowan commented Nov 9, 2016

Updated to cover all 4xx statuses and added further description to error struct

Split challenges into its own package. Avoids possible
import cycle with challenges from client.

Signed-off-by: Derek McGowan <[email protected]> (github: dmcgowan)
Allow clients to handle errors being set in the WWW-Authenticate
rather than in the body. The WWW-Authenticate errors give a
more precise error describing what is needed to authorize
with the server.

Signed-off-by: Derek McGowan <[email protected]> (github: dmcgowan)
@dmcgowan dmcgowan force-pushed the fix-authorization-error branch from b9114cc to 16396a7 Compare November 9, 2016 23:27
@codecov-io
Copy link

Current coverage is 51.35% (diff: 48.00%)

Merging #2047 into master will decrease coverage by 10.18%

@@             master      #2047   diff @@
==========================================
  Files           126        126           
  Lines         11275      11284      +9   
  Methods           0          0           
  Messages          0          0           
  Branches          0          0           
==========================================
- Hits           6939       5795   -1144   
- Misses         3449       4742   +1293   
+ Partials        887        747    -140   

Powered by Codecov. Last update 02f4195...16396a7

@aaronlehmann
Copy link

LGTM

1 similar comment
@stevvooe
Copy link
Collaborator

LGTM

@stevvooe stevvooe merged commit e04e6dd into distribution:master Nov 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants