-
-
Notifications
You must be signed in to change notification settings - Fork 365
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
Device grant flow (migrate to master) #701
Open
BuzzBumbleBee
wants to merge
67
commits into
ory:master
Choose a base branch
from
BuzzBumbleBee:feat_dev_grants_2x
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
67 commits
Select commit
Hold shift + click to select a range
ce02ff3
Device grant flow (migrate to master)
BuzzBumbleBee 9976360
Add own flow to the Device Grant
supercairos ae0144c
Generate Mocks & MemoryStore
supercairos 60e109b
Fix HMACSHA Test
supercairos 7b5a9ba
Fix fosite tests
supercairos b3e10dd
Merge pull request #3 from BuzzBumbleBee/rcaire/retry-pr
BuzzBumbleBee e216bb5
Merge remote-tracking branch 'github/master' into feat_dev_grants_2x
supercairos 0ff2699
Fix styling
supercairos 3665fc6
Fix merge errors
supercairos d710a40
Remove debug logs
supercairos eefdf61
Fix test following fix merge error
supercairos 57fb5ba
Remove "device_code" auth flow
supercairos 74ef995
Rename to follow Ory's file naming pattern
supercairos 873f022
Add some tests & documentations
supercairos 17b8665
Remove unused files & add some more tests
supercairos 375d89e
Use same method do generate authorization code & device code
supercairos dbd7860
Fix comment formating
supercairos 8585c75
Add test to device pkce
supercairos 4f7eb2b
rcaire/create-device-code-at-start
supercairos eea03e0
Split & Move files
supercairos 341d411
fix: edit comments
supercairos 0f0668b
Merge branch 'master' into feat_dev_grants_2x
supercairos a9aaaba
Merge branch 'feat_dev_grants_2x' into device-code-rework
supercairos fef42ec
Add missing handler in composer
supercairos b085d07
Merge branch 'master' into feat_dev_grants_2x
supercairos 3106872
Merge branch 'feat_dev_grants_2x' into device-code-rework
supercairos 9a30db2
Retry CI
supercairos 7bbeb02
Don't use `url.Values.Has()` as it doesn't exist in Golang 1.16...
supercairos 289f9a2
Merge branch 'feat_dev_grants_2x' into device-code-rework
supercairos 142b7ff
Change from Forbiden to BadRequest for authorization_pending to bette…
supercairos 6f66f32
Merge branch 'master' into feat_dev_grants_2x
supercairos 5722afa
Update go/x/text module to 0.4.0
supercairos a243b93
Merge branch 'master' into feat_dev_grants_2x
supercairos 46cdb1e
Merge branch 'master' into feat_dev_grants_2x
supercairos 3483d6e
Update following merge
supercairos 86c4f95
Initial refactoring following @hackerman recommandations
supercairos e23a26a
Update following integration test with Hydra
supercairos a99ed89
Fix build error
supercairos 88abd8d
Fix test
supercairos 1b29706
Merge branch 'master' into feat_dev_grants_2x
supercairos 3313b71
Use HTTP redirect instead of raw http header redirection
supercairos e99e2bc
Refactor the DeviceResponse struct to only have one definition of it.
supercairos 9279963
Use RandX instead of custom code to generate the Random UserCode
supercairos e60949d
Remove padding from HMAC generation to avoid confusion in URLs
supercairos ad37f5d
Use GrantType const string instead of raw string
supercairos ea146be
Split DeviceAuthorizeHandler and CodeAuthorizeHandler
supercairos 9fcb161
Merge branch 'master' into feat_dev_grants_2x
supercairos 1b306bb
Update Copyright header
supercairos 98709f3
Merge branch 'master' into feat_dev_grants_2x
supercairos 709a443
Merge branch 'master' into feat_dev_grants_2x
supercairos 8a2cf5c
Update fosite refactoring
supercairos 0395b8e
Merge branch 'master' into feat_dev_grants_2x
supercairos d2316f4
Fix some typo in config storage
supercairos 0e6f5fa
Merge branch 'master' into feat_dev_grants_2x
supercairos b1fbd36
Merge branch 'master' into feat_dev_grants_2x
supercairos 0847036
As per spec, set polling to 5s (from 10s)
supercairos 5b41e88
Fix typo in comment
supercairos 5f9b0b1
Add tracer as per AuthorizeRequest
supercairos bc70138
Fix comment in typo
supercairos c4b608a
use randx runes defined in ory/x
supercairos 6cded09
Remove PKCE
supercairos 7ad3851
Rename DeviceAuthorizeXXX to DeviceUserXXX
supercairos 10419a9
Refactor the way we query the URL Query params
supercairos 5bc8783
Don't send stacktrace when err is AuthorizationPending
supercairos e8b1654
Add RateLimit to Device Polling endpoint
supercairos 193f7d7
Bump ory/x version to latest
supercairos eee739a
Merge branch 'master' into feat_dev_grants_2x
supercairos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright © 2023 Ory Corp | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package compose | ||
|
||
import ( | ||
"github.com/ory/fosite" | ||
"github.com/ory/fosite/handler/oauth2" | ||
"github.com/ory/fosite/handler/rfc8628" | ||
) | ||
|
||
// RFC8628DeviceFactory creates an OAuth2 device code grant ("Device Authorization Grant") handler and registers | ||
// an user code, device code, access token and a refresh token validator. | ||
func RFC8628DeviceFactory(config fosite.Configurator, storage interface{}, strategy interface{}) interface{} { | ||
return &rfc8628.DeviceAuthHandler{ | ||
Strategy: strategy.(rfc8628.RFC8628CodeStrategy), | ||
Storage: storage.(rfc8628.RFC8628CodeStorage), | ||
Config: config, | ||
} | ||
} | ||
|
||
// RFC8628DeviceAuthorizationTokenFactory creates an OAuth2 device authorization grant ("Device Authorization Grant") handler and registers | ||
// an access token, refresh token and authorize code validator. | ||
func RFC8628DeviceAuthorizationTokenFactory(config fosite.Configurator, storage interface{}, strategy interface{}) interface{} { | ||
return &rfc8628.DeviceCodeTokenEndpointHandler{ | ||
GenericCodeTokenEndpointHandler: oauth2.GenericCodeTokenEndpointHandler{ | ||
CodeTokenEndpointHandler: &rfc8628.DeviceHandler{ | ||
DeviceRateLimitStrategy: strategy.(rfc8628.DeviceRateLimitStrategy), | ||
DeviceStrategy: strategy.(rfc8628.DeviceCodeStrategy), | ||
DeviceStorage: storage.(rfc8628.DeviceCodeStorage), | ||
}, | ||
AccessTokenStrategy: strategy.(oauth2.AccessTokenStrategy), | ||
RefreshTokenStrategy: strategy.(oauth2.RefreshTokenStrategy), | ||
CoreStorage: storage.(oauth2.CoreStorage), | ||
TokenRevocationStorage: storage.(oauth2.TokenRevocationStorage), | ||
Config: config, | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright © 2023 Ory Corp | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package fosite | ||
|
||
// DeviceRequest is an implementation of DeviceRequester | ||
type DeviceRequest struct { | ||
Request | ||
} | ||
|
||
func NewDeviceRequest() *DeviceRequest { | ||
return &DeviceRequest{ | ||
Request: *NewRequest(), | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is this always the same URL or would it differ on a per client basis?
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.
It's configured by the 'client'
This URL is used once the user has validated his login on his computer to display that he logged-in successfully and he can (physically) go back to his device.
It will be usally implemented by the ui-side of hydra but can bu actually any website.