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

Configuring session namespace does not change activeSessionsKey #81

Open
2 of 4 tasks
goeh opened this issue Jul 14, 2020 · 0 comments
Open
2 of 4 tasks

Configuring session namespace does not change activeSessionsKey #81

goeh opened this issue Jul 14, 2020 · 0 comments

Comments

@goeh
Copy link

goeh commented Jul 14, 2020

Task List

  • Steps to reproduce provided
  • Stacktrace (if present) provided
  • Example that reproduces the problem uploaded to Github
  • Full description of the issue provided (see below)

Steps to Reproduce

Change the default namespace for session keys in Redis:

micronaut.session.http.redis.namespace: 'myapp_sessions:'

Sessions are stored in Redis with the namespace prefix, but the key holding active sessions still uses the default prefix micronaut.session:

If you want active sessions to be under the same namespace you must also change active-sessions-key to include your namespace prefix, like this:

micronaut.session.http.redis.active-sessions-key: 'myapp_sessions:active-sessions'

Expected Behaviour

I expected active sessions to be stored with the namespace prefix when I configured namespace.

Actual Behaviour

Active sessions uses the default prefix "micronaut.session:' unless you explicitly configure micronaut.session.http.redis.active-sessions-key.

The key is prefixed with namespace when the class is instantiated but it is not changed when namespace is changed.
https://github.com/micronaut-projects/micronaut-redis/blob/master/redis-lettuce/src/main/java/io/micronaut/configuration/lettuce/session/RedisHttpSessionConfiguration.java#L42

IMO the behavior should be changed. If that's not possible due to the breaking change, it should be documented with a warning to avoid unexpected namespace pollution.

Some might argue that finding all active sessions (cross namespaces) using a single key is a feature. But I think that's a corner case.

Environment Information

  • Operating System: MacOS 10.15.5
  • Micronaut Version: 1.3.7
  • JDK Version: OpenJDK 11.0.7

Example Application

  • TODO: link to github repository with example that reproduces the issue
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