Skip to content
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 endpoint for invalidating all sessions for a given identity #1740

Merged
merged 19 commits into from
Sep 18, 2021

Conversation

harnash
Copy link
Contributor

@harnash harnash commented Sep 8, 2021

This PR introduces endpoint to destroy all sessions for a given identity which effectively logouts user from all devices/sessions. This is useful when for some security concern we want to make sure there are no "old" sessions active or other "staff" related actions (such as force logout after password change etc.).

Contributes to #655

Checklist

@harnash harnash changed the title Implement endpoint for invalidating all sessions for a given identity feat: Implement endpoint for invalidating all sessions for a given identity Sep 8, 2021
@codecov
Copy link

codecov bot commented Sep 8, 2021

Codecov Report

Merging #1740 (ff140dc) into master (28ad689) will increase coverage by 0.16%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1740      +/-   ##
==========================================
+ Coverage   73.94%   74.10%   +0.16%     
==========================================
  Files         260      260              
  Lines       12701    12714      +13     
==========================================
+ Hits         9392     9422      +30     
+ Misses       2682     2667      -15     
+ Partials      627      625       -2     
Impacted Files Coverage Δ
driver/registry_default.go 87.37% <100.00%> (+0.04%) ⬆️
session/handler.go 92.64% <100.00%> (+8.71%) ⬆️
persistence/sql/persister_courier.go 85.00% <0.00%> (-3.34%) ⬇️
x/nosurf.go 93.82% <0.00%> (+1.23%) ⬆️
courier/courier.go 68.34% <0.00%> (+10.07%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 28ad689...ff140dc. Read the comment docs.

Copy link
Member

@zepatrik zepatrik left a comment

Choose a reason for hiding this comment

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

Have you seen #655? It covers your use case as well. Just FYI and for linking this PR to that issue.
Not too happy about the path of the endpoint, but don't have a better idea right now 😅

session/handler.go Outdated Show resolved Hide resolved
session/handler.go Show resolved Hide resolved
session/handler.go Outdated Show resolved Hide resolved
@harnash
Copy link
Contributor Author

harnash commented Sep 10, 2021

Have you seen #655? It covers your use case as well. Just FYI and for linking this PR to that issue.

Oh. I've missed that. Thanks!

Not too happy about the path of the endpoint, but don't have a better idea right now 😅

Yeah. I would choose something more appropriate but moving it to /identites (I think I've tried that once) causes circular dependencies issues.

Copy link
Member

@aeneasr aeneasr left a comment

Choose a reason for hiding this comment

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

Awesome, thank you for your contribution! This looks pretty good and I have some ideas how to improve it further :)

session/handler.go Outdated Show resolved Hide resolved
session/handler.go Outdated Show resolved Hide resolved
session/handler.go Outdated Show resolved Hide resolved
session/handler.go Show resolved Hide resolved
session/handler.go Outdated Show resolved Hide resolved
session/handler_test.go Outdated Show resolved Hide resolved
Copy link
Member

@aeneasr aeneasr left a comment

Choose a reason for hiding this comment

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

Great! Just one minor thing :)

session/handler.go Outdated Show resolved Hide resolved
@aeneasr aeneasr merged commit dbd1689 into ory:master Sep 18, 2021
@harnash harnash deleted the session_purge branch September 18, 2021 17:05
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