Skip to content

Add specification for using OAuth with the token server - #1418

Merged
aaronlehmann merged 7 commits into
distribution:masterfrom
dmcgowan:oauth-spec
Mar 31, 2016
Merged

aaronlehmann merged 7 commits into
distribution:masterfrom
dmcgowan:oauth-spec

Conversation

@dmcgowan

@dmcgowan dmcgowan commented Feb 3, 2016

Copy link
Copy Markdown
Collaborator

Currently the token server uses a single short lived token which can only be fetched using basic auth credentials. This not only forces clients to save credentials but also makes properly scoping authorization requests difficult (basic auth credentials could be used for any account resource associated with the credentials, even those not in the domain of the authorization server). OAuth is standard practice for providing the necessary security scopes as well as limited credential leaking to clients. This initial version will still require sending credentials to the client but leaves the specification open for completely bypassing having to directly send credentials from the client using the OAuth authorization code grants.

This only PR only expands the specification and is intended to inform implementations of the registry client and token servers.

@codecov-io

Copy link
Copy Markdown

Current coverage is 56.12%

Merging #1418 into master will decrease coverage by -3.82% as of 093fbdb

@@            master   #1418   diff @@
======================================
  Files          128     123     -5
  Stmts        10859    9873   -986
  Branches       877     733   -144
  Methods          0       0       
======================================
- Hit           6509    5541   -968
+ Partial        877     733   -144
- Missed        3473    3599   +126

Review entire Coverage Diff as of 093fbdb


Uncovered Suggestions

  1. +0.18% via ...ge/driver/gcs/gcs.go#471...488
  2. +0.17% via ...ge/driver/oss/oss.go#150...166
  3. +0.16% via ...stry/handlers/app.go#231...246
  4. See 7 more...

Powered by Codecov. Updated on successful CI builds.

@dmp42 dmp42 added this to the Registry/2.4 milestone Feb 9, 2016
@BrianBland

Copy link
Copy Markdown
Contributor

Given that the Requesting a Bearer Token and Requesting a Refresh Token sections use the same endpoint, query parameters, and response values, perhaps we can get rid of the Requesting a Bearer Token section entirely. You already explain that the offline_token query param can be used to get the refresh token in addition to the access (bearer) token 👍

Edit: for clarification, I was referring to docs/spec/auth/token.md

Comment thread docs/spec/auth/token.md Outdated
`WWW-Authenticate` header.

## Requesting a Token
## Requesting an Bearer Token

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: an Bearer -> a Bearer

@dmcgowan

Copy link
Copy Markdown
Collaborator Author

@BrianBland I will attempt to merge the two sections

Signed-off-by: Derek McGowan <[email protected]> (github: dmcgowan)
Signed-off-by: Derek McGowan <[email protected]> (github: dmcgowan)
Use client_id as defined in oauth rfc instead of custom client field

Signed-off-by: Derek McGowan <[email protected]> (github: dmcgowan)
@dmcgowan

Copy link
Copy Markdown
Collaborator Author

Merged the sections, makes the changes to token.md much smaller. LMK if anyone thinks more clarification is needed in that doc to specify how and why it would be used. Realized having the definition spread across different docs may make it hard to follow what the correct usage is.

Allow providing multiple scopes in a single scope string

Signed-off-by: Derek McGowan <[email protected]> (github: dmcgowan)
@dmcgowan

Copy link
Copy Markdown
Collaborator Author

Updated the oauth section to account for single scope return field as well as requiring username and password be passed in via the form parameters as RFC6749 specifies (HTTP authorization header is reserved for future use of client password).

Comment thread docs/spec/auth/oauth.md Outdated
(Optional) Token which can be used to get additional access tokens for
the same subject with different scopes. This token should be kept secure
by the client and only sent to the authorization server which issues
bearer tokens. This field will only be set when `offline_token=true` is

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this means to say:

This field will only be set when `access_type=offline` is provided in the request.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes, you are right, It is the GET endpoint which uses a single boolean flag.

dmcgowan added 2 commits March 3, 2016 17:44
Add post response values
Update password grant type to match oauth spec

Signed-off-by: Derek McGowan <[email protected]> (github: dmcgowan)
The oauth spec defines using a space to separate parts of a scope.
To better comply with future implementations built on oauth use a space to separate the resource scopes.

Signed-off-by: Derek McGowan <[email protected]> (github: dmcgowan)
Signed-off-by: Derek McGowan <[email protected]> (github: dmcgowan)
@aaronlehmann

Copy link
Copy Markdown

LGTM

@aaronlehmann
aaronlehmann merged commit a11f6b6 into distribution:master Mar 31, 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.

6 participants