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

Custom instances of GenericPrincipal in WaffleAuthenticatorBase subclasses #561

Closed
Snap252 opened this issue Oct 12, 2017 · 1 comment
Closed

Comments

@Snap252
Copy link
Contributor

Snap252 commented Oct 12, 2017

In Module wffle-tomcat85:

waffle.apache.MixedAuthenticator and waffle.apache.NegotiateAuthenticator should both give the possibility to create other instances of Principal (e.g. for role detection) by extracting a protected method.
waffle.apache.NegotiateAuthenticator.authenticate(Request, HttpServletResponse):

           this.log.debug("logged in user: {} ({})", windowsIdentity.getFqn(), windowsIdentity.getSidString());

            final GenericPrincipal windowsPrincipal = createPrincipal(windowsIdentity);

            this.log.debug("roles: {}", Joiner.on(", ").join(windowsPrincipal.getRoles()));

with extracted overridable method

protected GenericPrincipal createPrincipal(final IWindowsIdentity windowsIdentity) {
	return new GenericWindowsPrincipal(windowsIdentity,
                    this.principalFormat, this.roleFormat)
}

for me I just need the framework to detect the current user name (no windows roles etc is needed) - the roles have to be detected by a further sql query inside the custom subclass of GenericPrincipal .
Due to the problem that this method is currently inlined, I have to copy a full class to make these changes.

Snap252 pushed a commit to Snap252/waffle that referenced this issue Nov 15, 2017
hazendaz pushed a commit that referenced this issue Dec 3, 2017
* Custom instances of GenericPrincipal in WaffleAuthenticatorBase
subclasses #561

* #571

* #571 (comment)

#571
+- replaced double space by single space

* #571

+ test case for custom principal

* #571 Custom instances of
GenericPrincipal in WaffleAuthenticatorBase #571

@Snap252 Can you add the same test case to tomcat7,8,9? Spring has now
released spring security 5 so now just wating on that piece from you to
merge this then a few rounds of testing and this will be released.
Thanks.
@hazendaz
Copy link
Member

This has been applied on master. Closing. Release of 1.9.0 will be out in next week or so.

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

2 participants