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

The /user/refresh endpoint triggers session.stop() #2344

Open
pieterlukasse opened this issue Feb 9, 2024 · 0 comments
Open

The /user/refresh endpoint triggers session.stop() #2344

pieterlukasse opened this issue Feb 9, 2024 · 0 comments

Comments

@pieterlukasse
Copy link
Contributor

Expected behavior

Session should only be removed when logging out, or upon expiration.

Actual behavior

Because of a call to session.stop() in src/main/java/org/ohdsi/webapi/shiro/filters/UpdateAccessTokenFilter.java(see
uc-cdis@32e90bc#diff-2ab1eba233c07d9653dbc0312742cf31baea8a755f797445784064efa44f88f9L118-L122), the session is removed in endpoints where it should not (like /user/refresh).

Steps to reproduce behavior

Run latest webapi w/ openid for example. Any attempt to retrieve session information after the filter above has been triggered as part of a later /user/refresh will fail with org.apache.shiro.subject.support.DisabledSessionException. Try for example the following steps:

  1. add some code like this to a custom filter that runs after UPDATE_TOKEN in the /user/refresh endpoint
    Subject subject = SecurityUtils.getSubject();
    return subject.getSession().getId().toString();
  1. setup openid based authentication
  2. login, go to cohorts, try to create and save a new cohort. This should trigger UpdateAccessTokenFilter again and the error reported here.
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

No branches or pull requests

1 participant