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
Changes from 2 commits
aeed603
0e45d98
a0ad6cb
be17e60
6c5e38e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,8 +11,6 @@ | |
*/ | ||
package waffle.apache; | ||
|
||
import com.sun.jna.platform.win32.Win32Exception; | ||
|
||
import java.io.IOException; | ||
import java.security.Principal; | ||
import java.util.Base64; | ||
|
@@ -22,8 +20,11 @@ | |
|
||
import org.apache.catalina.LifecycleException; | ||
import org.apache.catalina.connector.Request; | ||
import org.apache.catalina.realm.GenericPrincipal; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import com.sun.jna.platform.win32.Win32Exception; | ||
|
||
import waffle.util.AuthorizationHeader; | ||
import waffle.util.NtlmServletRequest; | ||
import waffle.windows.auth.IWindowsIdentity; | ||
|
@@ -158,12 +159,11 @@ public boolean authenticate(final Request request, final HttpServletResponse res | |
try { | ||
this.log.debug("logged in user: {} ({})", windowsIdentity.getFqn(), windowsIdentity.getSidString()); | ||
|
||
final GenericWindowsPrincipal windowsPrincipal = new GenericWindowsPrincipal(windowsIdentity, | ||
this.principalFormat, this.roleFormat); | ||
final GenericPrincipal genericPrincipal = createPrincipal(windowsIdentity); | ||
|
||
this.log.debug("roles: {}", windowsPrincipal.getRolesString()); | ||
this.log.debug("roles: {}", String.join(", ", genericPrincipal.getRoles())); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please revert the change above. getRolesString() already does the string joiner. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nevermind I see why now. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
||
principal = windowsPrincipal; | ||
principal = genericPrincipal; | ||
|
||
// create a session associated with this request if there's none | ||
final HttpSession session = request.getSession(true); | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?