From 032067b5d0a521c8e7261de2cad1f89fc3ec5d1f Mon Sep 17 00:00:00 2001 From: Jeremy Landis Date: Sat, 20 Jan 2024 21:34:20 -0500 Subject: [PATCH] [cleanup] Minor code cleanup --- README.md | 8 ++++---- Source/JNA/src/site/markdown/README.md | 8 ++++---- .../waffle/servlet/NegotiateSecurityFilterTest.java | 8 ++++---- .../java/waffle/servlet/WaffleInfoServletTest.java | 8 ++------ .../windows/auth/WindowsAuthProviderLoadTest.java | 11 +---------- 5 files changed, 15 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 391e4f7e35..0255a66afd 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ WAFFLE - Windows Authentication Framework WAFFLE is a native Windows Authentication Framework consisting of two C# and Java libraries that perform functions related to Windows authentication, supporting Negotiate, NTLM and Kerberos. Waffle also includes libraries that enable drop-in Windows Single Sign On for popular Java web servers, when running on Windows. While Waffle makes it ridiculously easy to do Windows Authentication in Java, on Windows, Waffle does not work on *nix(UNIX-like). -Unlike many other implementations Waffle on Windows does not require any server-side Kerberos keytab setup, it's a drop-in solution. You can see it in action in [this slightly blurry video](https://www.youtube.com/watch?v=LmTwbOh0hBU) produced for [TeamShatter.com](http://www.teamshatter.com/topics/general/team-shatter-exclusive/securing-java-applications-with-smart-cards-and-single-sign-on/). +Unlike many other implementations Waffle on Windows does not require any server-side Kerberos keytab setup, it's a drop-in solution. You can see it in action in [this slightly blurry video](https://www.youtube.com/watch?v=LmTwbOh0hBU) produced for [TeamShatter.com](http://www.teamshatter.com/topics/general/team-shatter-exclusive/securing-java-applications-with-smart-cards-and-single-sign-on/). Sites ----- @@ -69,7 +69,7 @@ Features How do I resolve JNA `NoClassDefFound` errors? ---------------------------------------------- WAFFLE uses the latest version of JNA, which may conflict with other dependencies your project (or its parent) includes. If you experience issues with `NoClassDefFound` errors for JNA artifacts, consider one or more of the following steps to resolve the conflict: -* Listing WAFFLE earlier (or first) in your dependency list +* Listing WAFFLE earlier (or first) in your dependency list * Specifying the most recent version of JNA as a dependency * If you are using a parent (e.g., Spring Boot) that includes JNA as a dependency, override the `jna.version` property @@ -93,12 +93,12 @@ Contributing * [Set Up a Development Environment](Docs/SettingUpDevelopmentEnvironment.md). * Make your code changes. Don't forget tests. * Update [CHANGELOG](CHANGELOG.md). -* Make pull requests. Bonus points for topic branches. +* Make pull requests. Bonus points for topic branches. License and Copyright --------------------- -Copyright (c) [Application Security Inc.](https://www.trustwave.com/Company/AppSecInc-is-now-Trustwave/), 2010-2020 and Contributors. +Copyright (c) [Application Security Inc.](https://www.trustwave.com/Company/AppSecInc-is-now-Trustwave/), 2010-2020 and Contributors. This project is licensed under the [MIT License](https://github.com/Waffle/waffle/blob/master/LICENSE). diff --git a/Source/JNA/src/site/markdown/README.md b/Source/JNA/src/site/markdown/README.md index 391e4f7e35..0255a66afd 100644 --- a/Source/JNA/src/site/markdown/README.md +++ b/Source/JNA/src/site/markdown/README.md @@ -17,7 +17,7 @@ WAFFLE - Windows Authentication Framework WAFFLE is a native Windows Authentication Framework consisting of two C# and Java libraries that perform functions related to Windows authentication, supporting Negotiate, NTLM and Kerberos. Waffle also includes libraries that enable drop-in Windows Single Sign On for popular Java web servers, when running on Windows. While Waffle makes it ridiculously easy to do Windows Authentication in Java, on Windows, Waffle does not work on *nix(UNIX-like). -Unlike many other implementations Waffle on Windows does not require any server-side Kerberos keytab setup, it's a drop-in solution. You can see it in action in [this slightly blurry video](https://www.youtube.com/watch?v=LmTwbOh0hBU) produced for [TeamShatter.com](http://www.teamshatter.com/topics/general/team-shatter-exclusive/securing-java-applications-with-smart-cards-and-single-sign-on/). +Unlike many other implementations Waffle on Windows does not require any server-side Kerberos keytab setup, it's a drop-in solution. You can see it in action in [this slightly blurry video](https://www.youtube.com/watch?v=LmTwbOh0hBU) produced for [TeamShatter.com](http://www.teamshatter.com/topics/general/team-shatter-exclusive/securing-java-applications-with-smart-cards-and-single-sign-on/). Sites ----- @@ -69,7 +69,7 @@ Features How do I resolve JNA `NoClassDefFound` errors? ---------------------------------------------- WAFFLE uses the latest version of JNA, which may conflict with other dependencies your project (or its parent) includes. If you experience issues with `NoClassDefFound` errors for JNA artifacts, consider one or more of the following steps to resolve the conflict: -* Listing WAFFLE earlier (or first) in your dependency list +* Listing WAFFLE earlier (or first) in your dependency list * Specifying the most recent version of JNA as a dependency * If you are using a parent (e.g., Spring Boot) that includes JNA as a dependency, override the `jna.version` property @@ -93,12 +93,12 @@ Contributing * [Set Up a Development Environment](Docs/SettingUpDevelopmentEnvironment.md). * Make your code changes. Don't forget tests. * Update [CHANGELOG](CHANGELOG.md). -* Make pull requests. Bonus points for topic branches. +* Make pull requests. Bonus points for topic branches. License and Copyright --------------------- -Copyright (c) [Application Security Inc.](https://www.trustwave.com/Company/AppSecInc-is-now-Trustwave/), 2010-2020 and Contributors. +Copyright (c) [Application Security Inc.](https://www.trustwave.com/Company/AppSecInc-is-now-Trustwave/), 2010-2020 and Contributors. This project is licensed under the [MIT License](https://github.com/Waffle/waffle/blob/master/LICENSE). diff --git a/Source/JNA/waffle-tests-jakarta/src/test/java/waffle/servlet/NegotiateSecurityFilterTest.java b/Source/JNA/waffle-tests-jakarta/src/test/java/waffle/servlet/NegotiateSecurityFilterTest.java index 2869345aa1..6f9d9b54be 100644 --- a/Source/JNA/waffle-tests-jakarta/src/test/java/waffle/servlet/NegotiateSecurityFilterTest.java +++ b/Source/JNA/waffle-tests-jakarta/src/test/java/waffle/servlet/NegotiateSecurityFilterTest.java @@ -336,8 +336,8 @@ void testInitBasicSecurityFilterProvider() throws ServletException { filterConfig.setParameter("waffle.servlet.spi.BasicSecurityFilterProvider/realm", "DemoRealm"); filterConfig.setParameter("authProvider", MockWindowsAuthProvider.class.getName()); this.filter.init(filterConfig); - Assertions.assertEquals(this.filter.getPrincipalFormat(), PrincipalFormat.SID); - Assertions.assertEquals(this.filter.getRoleFormat(), PrincipalFormat.NONE); + Assertions.assertEquals(PrincipalFormat.SID, this.filter.getPrincipalFormat()); + Assertions.assertEquals(PrincipalFormat.NONE, this.filter.getRoleFormat()); Assertions.assertTrue(this.filter.isAllowGuestLogin()); Assertions.assertEquals(1, this.filter.getProviders().size()); Assertions.assertTrue(this.filter.getAuth() instanceof MockWindowsAuthProvider); @@ -372,8 +372,8 @@ void testInitNegotiateSecurityFilterProvider() throws ServletException { filterConfig.setParameter("waffle.servlet.spi.NegotiateSecurityFilterProvider/protocols", "NTLM\nNegotiate NTLM"); this.filter.init(filterConfig); - Assertions.assertEquals(this.filter.getPrincipalFormat(), PrincipalFormat.FQN); - Assertions.assertEquals(this.filter.getRoleFormat(), PrincipalFormat.FQN); + Assertions.assertEquals(PrincipalFormat.FQN, this.filter.getPrincipalFormat()); + Assertions.assertEquals(PrincipalFormat.FQN, this.filter.getRoleFormat()); Assertions.assertTrue(this.filter.isAllowGuestLogin()); Assertions.assertEquals(1, this.filter.getProviders().size()); } diff --git a/Source/JNA/waffle-tests-jakarta/src/test/java/waffle/servlet/WaffleInfoServletTest.java b/Source/JNA/waffle-tests-jakarta/src/test/java/waffle/servlet/WaffleInfoServletTest.java index 5765ec8ce1..0aa580a8a3 100644 --- a/Source/JNA/waffle-tests-jakarta/src/test/java/waffle/servlet/WaffleInfoServletTest.java +++ b/Source/JNA/waffle-tests-jakarta/src/test/java/waffle/servlet/WaffleInfoServletTest.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2010-2022 The Waffle Project Contributors: https://github.com/Waffle/waffle/graphs/contributors + * Copyright (c) 2010-2024 The Waffle Project Contributors: https://github.com/Waffle/waffle/graphs/contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -25,8 +25,6 @@ import com.sun.jna.Platform; -import jakarta.servlet.ServletException; - import java.io.IOException; import java.io.StringReader; @@ -63,11 +61,9 @@ class WaffleInfoServletTest { * the SAX exception * @throws IOException * Signals that an I/O exception has occurred. - * @throws ServletException - * the servlet exception */ @Test - void testGetInfo() throws ParserConfigurationException, SAXException, IOException, ServletException { + void testGetInfo() throws ParserConfigurationException, SAXException, IOException { final SimpleHttpRequest request = new SimpleHttpRequest(); request.addHeader("hello", "waffle"); diff --git a/Source/JNA/waffle-tests-jakarta/src/test/java/waffle/windows/auth/WindowsAuthProviderLoadTest.java b/Source/JNA/waffle-tests-jakarta/src/test/java/waffle/windows/auth/WindowsAuthProviderLoadTest.java index 3eac58137f..7686ef2660 100644 --- a/Source/JNA/waffle-tests-jakarta/src/test/java/waffle/windows/auth/WindowsAuthProviderLoadTest.java +++ b/Source/JNA/waffle-tests-jakarta/src/test/java/waffle/windows/auth/WindowsAuthProviderLoadTest.java @@ -23,10 +23,6 @@ */ package waffle.windows.auth; -import jakarta.servlet.ServletException; - -import java.io.IOException; - import org.junit.jupiter.api.Test; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Scope; @@ -64,14 +60,9 @@ public static class St { /** * Benchmark. - * - * @throws IOException - * Signals that an I/O exception has occurred. - * @throws ServletException - * the servlet exception */ @Benchmark - public void benchmark() throws IOException, ServletException { + public void benchmark() { this.tests.testAcceptSecurityToken(); }