-
Notifications
You must be signed in to change notification settings - Fork 969
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: Add session renew capabilities, #615 #2146
Conversation
647d112
to
9aa0d49
Compare
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.
Great job! Just a few notes :) Could you please also add a guide to the docs how to use this feature?
It looks like there's a lint issue: https://app.circleci.com/pipelines/github/ory/kratos/5952/workflows/0452509a-af7c-4dc4-88ac-87c189d19b29/jobs/31412 :) |
Co-authored-by: hackerman <3372410+aeneasr@users.noreply.github.com>
919f315
to
d535f97
Compare
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.
Thank you! This is looking grand! I just have two minor things regarding the API route structure :)
session/handler.go
Outdated
ID string `json:"id"` | ||
} | ||
|
||
// swagger:route PATCH /sessions/refresh/{id} v0alpha2 adminSessionRefresh |
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.
We try to have structure with REST resource model, so this would be:
// swagger:route PATCH /sessions/refresh/{id} v0alpha2 adminSessionRefresh | |
// swagger:route PATCH /sessions/{id}/refresh v0alpha2 adminRefreshSession |
or
// swagger:route PATCH /sessions/refresh/{id} v0alpha2 adminSessionRefresh | |
// swagger:route PATCH /sessions/{id}?refresh=true v0alpha2 adminRefreshSession |
session/handler.go
Outdated
// Calling this endpoint refreshes a given session. | ||
// If `session.earliest_refresh` is set it will only refresh the session after this time has passed. |
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.
// Calling this endpoint refreshes a given session. | |
// If `session.earliest_refresh` is set it will only refresh the session after this time has passed. | |
// Calling this endpoint refreshes the given session ID. | |
// If `session.earliest_refresh` is set it will only refresh the session after this time has passed. |
session/handler.go
Outdated
// This endpoint is useful for: | ||
// | ||
// - Session refresh |
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 endpoint is useful for: | |
// | |
// - Session refresh |
session/handler.go
Outdated
// swagger:route PATCH /sessions/refresh v0alpha2 adminCurrentSessionRefresh | ||
// | ||
// Calling this endpoint refreshes a given session. | ||
// If `session.earliest_refresh` is set it will only refresh the session after this time has passed. | ||
// | ||
// This endpoint is useful for: | ||
// | ||
// - Session refresh | ||
// | ||
// Schemes: http, https | ||
// | ||
// Security: | ||
// oryAccessToken: | ||
// | ||
// Responses: |
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 think this route would currently cause a conflict with the other session routes? I would suggest:
// swagger:route PATCH /sessions/refresh v0alpha2 adminCurrentSessionRefresh | |
// | |
// Calling this endpoint refreshes a given session. | |
// If `session.earliest_refresh` is set it will only refresh the session after this time has passed. | |
// | |
// This endpoint is useful for: | |
// | |
// - Session refresh | |
// | |
// Schemes: http, https | |
// | |
// Security: | |
// oryAccessToken: | |
// | |
// Responses: | |
// swagger:route PATCH /sessions?refresh=true v0alpha2 adminRefreshSessionFromCredentials | |
// | |
// Calling this endpoint you can refresh an Ory Session Cookie or Ory Session Token. You must | |
// include the Ory Session Token in the `Cookie` header or the Ory Session Token in the `X-Session-Token` | |
// header. | |
// | |
// If `session.earliest_refresh` is set it will only refresh the session after this time has passed. | |
// | |
// Schemes: http, https | |
// | |
// Security: | |
// oryAccessToken: | |
// | |
// Responses: |
Please also add these keys (x-session-token, cookie) to the argument this method can receive (see the whoami endpoint for an example) :)
What is the status of this PR - is it stale? We are also investigating this and are interested in it. |
If you want to pick this up please feel free to do so! :) |
Codecov Report
@@ Coverage Diff @@
## master #2146 +/- ##
==========================================
- Coverage 76.62% 76.59% -0.03%
==========================================
Files 318 318
Lines 17190 17217 +27
==========================================
+ Hits 13171 13187 +16
- Misses 3087 3097 +10
- Partials 932 933 +1
Continue to review full report at Codecov.
|
I don't think that we can add the refresh functionality as it is right now to |
Great to see this is making progress. I believe that the admin API refresh capabilities will cover most of the use cases. |
I'll try to get this merged before my vacation |
Closes ory#615 Co-authored-by: hackerman <3372410+aeneasr@users.noreply.github.com>
Closes ory#615 Co-authored-by: hackerman <3372410+aeneasr@users.noreply.github.com>
Add session renew to kratos:
Related issue(s)
#615
Checklist
introduces a new feature.
contributing code guidelines.
vulnerability. If this pull request addresses a security. vulnerability, I
confirm that I got green light (please contact
security@ory.sh) from the maintainers to push
the changes.
works.
Further Comments
It's a follow-up after this pr on our repo: Wikia#48