-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
feat: implement RFC 8628 #3851
Open
nsklikas
wants to merge
36
commits into
ory:master
Choose a base branch
from
canonical:canonical-master
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
feat: implement RFC 8628 #3851
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
d4f1f02
chore: install fosite from branch (remove)
nsklikas 14d2af7
fix: set utc expires_at
nsklikas 2c0f9a0
fix: add redirect_uri to test
nsklikas a99fa3d
fix: add rfc8628 providers to registry
nsklikas 0832c17
fix: update database schema
nsklikas 905f610
fix: update oauth persister logic
nsklikas 8f4a1ab
feat: add device authorization endpoint handler
nsklikas e86d044
refactor: move logic to updateSessionWithRequest method
nsklikas cb84dd4
fix: rename device auth endpoint handler
nsklikas d9c3ecc
feat: add device user verification handler
nsklikas 365a980
fix: implement device user verification logic
nsklikas 86e46dd
feat: update flow
nsklikas c4b28f8
fix: add post device auth handler
nsklikas 1efbd3a
feat: add consent handler for accepting a user_code
nsklikas 45abdba
chore: add post_device_done to config schema
nsklikas 0921426
chore: add e2e tests
nsklikas 99b5a1a
feat: token request handling for device flow
wood-push-melon 7daab9f
chore: update config
nsklikas 7e60cc0
fix: fix the OIDC token and refresh token issue for device flow
wood-push-melon 413f7c1
fix: update OpenID Connect session after user consent
wood-push-melon a140169
fix: add GetDeviceCodeSessionByRequestID method
nsklikas ff9933c
fix: return client_id to post_device page
nsklikas eec977c
fix: update existing device session
nsklikas 87b2cef
fix: update tests
nsklikas b9e587f
fix: add device auth endpoint in discovery metadata
nsklikas 5c56722
fix: make device grant lifetimes configurable
nsklikas 8dfdaea
test: update sql fixtures
nsklikas 159c178
fix: perform device flow from CLI
nsklikas ae1afc2
fix: wrap db calls in transaction
nsklikas 872bebd
chore: fix license
nsklikas 9f2dec8
chore: update sdk
nsklikas 968a4a1
fix: duplicate user_code update
nsklikas a6c8cee
refactor: merge user and device code tables
nsklikas ccafea3
fix: create openid session when log in succeeds
nsklikas ced8b62
refactor: update device session persistence logic
nsklikas 469c5e1
fix: update oauth persister logic
nsklikas 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
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
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
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
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 |
---|---|---|
|
@@ -79,6 +79,7 @@ type Client struct { | |
// - OpenID Connect Implicit Grant (deprecated!): `implicit` | ||
// - Refresh Token Grant: `refresh_token` | ||
// - OAuth 2.0 Token Exchange: `urn:ietf:params:oauth:grant-type:jwt-bearer` | ||
// - OAuth 2.0 Device Code Grant: `urn:ietf:params:oauth:grant-type:device_code` | ||
GrantTypes sqlxx.StringSliceJSONFormat `json:"grant_types" db:"grant_types"` | ||
|
||
// OAuth 2.0 Client Response Types | ||
|
@@ -379,6 +380,21 @@ type Lifespans struct { | |
// | ||
// The lifespan of a refresh token issued by the OAuth2 2.0 Refresh Token Grant for this OAuth 2.0 Client. | ||
RefreshTokenGrantRefreshTokenLifespan x.NullDuration `json:"refresh_token_grant_refresh_token_lifespan,omitempty" db:"refresh_token_grant_refresh_token_lifespan"` | ||
|
||
// OAuth2 2.0 Device Authorization Grant ID Token Lifespan | ||
// | ||
// The lifespan of an ID token issued by the OAuth2 2.0 Device Authorization Grant for this OAuth 2.0 Client. | ||
DeviceAuthorizationGrantIDTokenLifespan x.NullDuration `json:"device_authorization_grant_id_token_lifespan,omitempty" db:"device_authorization_grant_id_token_lifespan"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note to self: this will increase the challenge size |
||
|
||
// OAuth2 2.0 Device Authorization Grant Access Token Lifespan | ||
// | ||
// The lifespan of an access token issued by the OAuth2 2.0 Device Authorization Grant for this OAuth 2.0 Client. | ||
DeviceAuthorizationGrantAccessTokenLifespan x.NullDuration `json:"device_authorization_grant_access_token_lifespan,omitempty" db:"device_authorization_grant_access_token_lifespan"` | ||
|
||
// OAuth2 2.0 Device Authorization Grant Device Authorization Lifespan | ||
// | ||
// The lifespan of a Device Authorization issued by the OAuth2 2.0 Device Authorization Grant for this OAuth 2.0 Client. | ||
DeviceAuthorizationGrantRefreshTokenLifespan x.NullDuration `json:"device_authorization_grant_refresh_token_lifespan,omitempty" db:"device_authorization_grant_refresh_token_lifespan"` | ||
} | ||
|
||
func (Client) TableName() string { | ||
|
@@ -549,6 +565,14 @@ func (c *Client) GetEffectiveLifespan(gt fosite.GrantType, tt fosite.TokenType, | |
} else if tt == fosite.RefreshToken && c.RefreshTokenGrantRefreshTokenLifespan.Valid { | ||
cl = &c.RefreshTokenGrantRefreshTokenLifespan.Duration | ||
} | ||
} else if gt == fosite.GrantTypeDeviceCode { | ||
if tt == fosite.AccessToken && c.DeviceAuthorizationGrantAccessTokenLifespan.Valid { | ||
cl = &c.DeviceAuthorizationGrantAccessTokenLifespan.Duration | ||
} else if tt == fosite.IDToken && c.DeviceAuthorizationGrantIDTokenLifespan.Valid { | ||
cl = &c.DeviceAuthorizationGrantIDTokenLifespan.Duration | ||
} else if tt == fosite.RefreshToken && c.DeviceAuthorizationGrantRefreshTokenLifespan.Valid { | ||
cl = &c.DeviceAuthorizationGrantRefreshTokenLifespan.Duration | ||
} | ||
} | ||
|
||
if cl == nil { | ||
|
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
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.
There are several new config keys. Please add them here