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

ThreadLocal based Inspektr PrincipalResolver #1957

Merged
merged 3 commits into from Aug 18, 2016
Merged

ThreadLocal based Inspektr PrincipalResolver #1957

merged 3 commits into from Aug 18, 2016

Conversation

dima767
Copy link
Contributor

@dima767 dima767 commented Aug 17, 2016

This PR introduces a ThreadLocal based storage for current Authentication object as well as Inspektr PrincipalResolver based on that state. This is in response to already complex and brittle current Joinpoint-based PrincipalResolver that does complex Joinpoint parsing and is very tightly coupled to CAS API which in the latest iterations has changed significantly and therefore this resolver is not able to resolve proper principal at all the configured audit points.

This PR also has the side effect that this ThreadLocal holder for current authentication could be used by other interested downstream components without tight coupling to all the internal CAS components just to get a currently in-progress authentication/principal, should they need it.

* components that are not tightly coupled with core CAS APIs, for example audit principal resolver component, etc.
* <p>
* The thread local state carried by this class should be set by core CAS components processing core authentication and
* CAS protocol events e.g. <code>AbstractAuthenticationManager</code>, <code>CentralAuthenticationServiceImpl</code>, etc.
Copy link
Member

Choose a reason for hiding this comment

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

Minor suggestion: try using {@link}. Helps with future refactoring, if the class should be renamed, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will add the link, but that will require compile dependency on the module in question :-)

Copy link
Member

Choose a reason for hiding this comment

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

Gotcha. Lets keep it then.

@mmoayyed
Copy link
Member

Thanks @dima767 Looks excellent. Few minor questions here and there.

@mmoayyed mmoayyed merged commit 45bed23 into apereo:master Aug 18, 2016
@mmoayyed mmoayyed deleted the properly-resolved-audit-principal branch August 18, 2016 14:17
mmoayyed pushed a commit that referenced this pull request Sep 19, 2016
* ThreadLocal based Inspektr PrincipalResolver

* Refactor to fix NPE bug

* Polishing based on feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants