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

Cache is being shared between mappers #12

Open
alefcarlos opened this issue Oct 4, 2024 · 1 comment
Open

Cache is being shared between mappers #12

alefcarlos opened this issue Oct 4, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@alefcarlos
Copy link

alefcarlos commented Oct 4, 2024

Hey! Thank for this package, but I found an issue(idk if this is expected).

If we create multiple mappers the claims values are reused, but it work if you have ONLY ONE mapper:

final String resolvedClientRolesAttributesAttrName = RESOLVED_CLIENT_ROLES_ATTRIBUTES_ATTR + ":" + clientSessionCtx.getClientSession().getUserSession().getId();

To solve this, for now, I'm adding the mapping model id to the cache key:

final String resolvedClientRolesAttributesAttrName = RESOLVED_CLIENT_ROLES_ATTRIBUTES_ATTR + ":" + mappingModelId + ":" + clientSessionCtx.getClientSession().getUserSession().getId();

And now all the generated claims have the expected values ;)

Do you accept a PR?

And one thing to think: this infomation should have be cached?

@s-frei
Copy link
Member

s-frei commented Oct 22, 2024

Hi there,

sorry for answering that late, to many notifactions 😉

Well, I guess the behaviour you described should not happen. Seems like at the time of writing this I only tested this
manually using one mapper and there are no other tests...

This was, at the time of writing, more or less for a POC and I am currently into other things, but for sure I'll accept PRs,
so if others stumble upon this, they don't need to fix it themselves.

Can't remember why I decided to cache the claims, but this also depends on how often the token is refreshed.
Maybe this could be disabled by configuration forwarding the decision to the person using it.

@s-frei s-frei added the bug Something isn't working label Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants