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 #571

Merged
merged 5 commits into from
Dec 3, 2017

Conversation

Snap252
Copy link
Contributor

@Snap252 Snap252 commented Nov 15, 2017

refering:
#561

my main target is it to get the roles not directly by the windows roles but by a further mechanism that gets some roles from a database query using the current windowsIdentity as a query parameter


this.log.debug("roles: {}", windowsPrincipal.getRolesString());
this.log.debug("roles: {}", String.join(", ", genericPrincipal.getRoles()));
Copy link
Member

Choose a reason for hiding this comment

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

Please revert the change above. getRolesString() already does the string joiner.

Copy link
Member

Choose a reason for hiding this comment

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

nevermind I see why now.

Copy link
Contributor Author

@Snap252 Snap252 Nov 18, 2017

Choose a reason for hiding this comment

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

Using the toString-Method in log output would give the possibility to use more generic interfaces
this.log.debug("roles: {}", String.join(", ", genericPrincipal.getRoles()));
->
this.log.debug("principal: {}", principal.toString());

@hazendaz
Copy link
Member

@Snap252 Can you also make the same change to all other negotiateAuthenticators? That way it is supported throughout. Thanks in advance.

@dblock
Copy link
Collaborator

dblock commented Nov 18, 2017

This method should go into the parent class I believe and be invoked from https://github.com/Waffle/waffle/blob/master/Source/JNA/waffle-tomcat7/src/main/java/waffle/apache/WaffleAuthenticatorBase.java#L246 as well. It also needs tests.

@Snap252
Copy link
Contributor Author

Snap252 commented Nov 18, 2017

Thx for the fast feedback.

  • I pulled up the method to WaffleAuthenticatorBase
  • I made the changes in all tomcat versions (but is there any difference between 8.5 and 9 - I can find only one deprecation in source code)

If you tell me that this is the right way I will write some testing code and enhance code coverage.


this.log.debug("roles: {}", windowsPrincipal.getRolesString());
this.log.debug("roles: {}", String.join(", ", genericPrincipal.getRoles()));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor: one space too many.

Copy link
Member

Choose a reason for hiding this comment

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

Run a quick build, that will flush out that space or any others.

Copy link
Member

Choose a reason for hiding this comment

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

@Snap252 There isn't really much difference between the various integrations. We probably could use an overall refactoring to make things better. For now though, as new builds become available, because we brand the version, we supply a new copy. So tomcat 9 is really just tomcat 8.5 with the minor variance you saw. Spring 3, 4, and 5 copies I believe are completely identical. Just haven't had time to really go in and look how to make it more streamlined.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Run a quick build, that will flush out that space or any others.

  • hazendaz

I already tried a maven test / maven install - but this kills me all the formatting (in existing and untouched files) - Am I doing something wrong, or is there anything I needed to know to keep formatting?

@hazendaz
Copy link
Member

@Snap252 Just for reference of when this might get released. I'm waiting on spring security 5 to be officially released. Once that is done, I plan to push out 1.9.0 version of waffle. I'll include this work with it. Thanks.

@hazendaz
Copy link
Member

hazendaz commented Dec 2, 2017

@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.

GenericPrincipal in WaffleAuthenticatorBase Waffle#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.
@Snap252
Copy link
Contributor Author

Snap252 commented Dec 2, 2017

I was not sure if these tests are enough - and before copying it to the other subprojects I was waiting for your feedback 👍
But I think this is the result wanted. Let me know if anything is missing.
Thx

@hazendaz
Copy link
Member

hazendaz commented Dec 3, 2017

I think it's good enough for what I can see here. I'll run some coverage after merging. I'm merging now. Thanks for getting this squared away.

@hazendaz hazendaz merged commit 75f274e into Waffle:master Dec 3, 2017
hazendaz added a commit to hazendaz/waffle that referenced this pull request Dec 18, 2017
hazendaz added a commit that referenced this pull request Dec 18, 2017
Custom instances of GenericPrincipal in WaffleAuthenticatorBase (#571)
@Snap252
Copy link
Contributor Author

Snap252 commented Feb 5, 2018

I feel a pretty guilty here,

I think it's good enough for what I can see here.

I thought it is done. Can you tell me, what is still to do here?

Kind regards.

@hazendaz
Copy link
Member

hazendaz commented Feb 5, 2018 via email

Snap252 pushed a commit to Snap252/waffle that referenced this pull request Feb 19, 2018
++ synchronized tomcat8 + tomcat7
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

Successfully merging this pull request may close these issues.

3 participants