Skip to content

Commit 4afed96

Browse files
Merge pull request #48 from jenkinsci/updates/waffle-jna-jakarta-3.4.0
Update waffle-jna-jakarta to 3.4.0
2 parents da2b6a7 + 6ba1e56 commit 4afed96

File tree

7 files changed

+121
-101
lines changed

7 files changed

+121
-101
lines changed

pom.xml

+7-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<!-- TODO JENKINS-73339 until in parent POM -->
3333
<jenkins-test-harness.version>2254.vcff7a_d4969e5</jenkins-test-harness.version>
3434
<maven.compiler.release>17</maven.compiler.release>
35-
<waffle.version>2.3.0</waffle.version>
35+
<waffle.version>3.4.0</waffle.version>
3636
<jna.version>5.14.0</jna.version><!-- Specified here because jna-platform does need to be the same version as jna -->
3737
</properties>
3838

@@ -54,6 +54,12 @@
5454
<artifactId>waffle-jna-jakarta</artifactId>
5555
<version>${waffle.version}</version>
5656
</dependency>
57+
<!-- waffle-jna-jakarta 3.4.0 caffeine dependency has a newer dependency on error_prone_annotations than plugin pom 4.87 / jenkins 2.475 -->
58+
<dependency>
59+
<groupId>com.google.errorprone</groupId>
60+
<artifactId>error_prone_annotations</artifactId>
61+
<version>2.21.1</version>
62+
</dependency>
5763
<!-- TODO JENKINS-73339 until in parent POM, work around https://github.com/jenkinsci/plugin-pom/issues/936 -->
5864
<dependency>
5965
<groupId>jakarta.servlet</groupId>

src/main/java/com/github/farmgeek4life/jenkins/negotiatesso/NegSecFilter.java

+18-18
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2121
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222
* THE SOFTWARE.
23-
*
24-
* This class extends a Waffle class. See https://github.com/dblock/waffle for
25-
* appropriate licenses for Waffle, which are not included here (as I do not
23+
*
24+
* This class extends a Waffle class. See https://github.com/dblock/waffle for
25+
* appropriate licenses for Waffle, which are not included here (as I do not
2626
* include any source code from Waffle).
27-
*
28-
* Portions of this code are based on the KerberosSSO plugin, also licensed
29-
* under the MIT License. See https://github.com/jenkinsci/kerberos-sso-plugin
27+
*
28+
* Portions of this code are based on the KerberosSSO plugin, also licensed
29+
* under the MIT License. See https://github.com/jenkinsci/kerberos-sso-plugin
3030
* for license details.
3131
*/
3232

@@ -83,7 +83,7 @@ public void doFilter(final ServletRequest request, final ServletResponse respons
8383
chain.doFilter(request, response);
8484
return;
8585
}
86-
86+
8787
HttpServletRequest httpRequest = (HttpServletRequest)request;
8888
String requestUri = httpRequest.getRequestURI();
8989
// After Jenkins 1.590:
@@ -93,14 +93,14 @@ public void doFilter(final ServletRequest request, final ServletResponse respons
9393
chain.doFilter(request, response);
9494
return;
9595
}
96-
96+
9797
if (this.allowLocalhost && httpRequest.getLocalAddr().equals(httpRequest.getRemoteAddr())) {
9898
// User is localhost, and we want to skip authenticating localhost
9999
LOGGER.log(Level.FINEST, "Bypassing authentication for localhost to {0}", requestUri);
100100
chain.doFilter(request, response);
101101
return;
102102
}
103-
103+
104104
if (this.redirectEnabled && !httpRequest.getLocalAddr().equals(httpRequest.getRemoteAddr())) {
105105
// If local and remote addresses are identical, user is localhost and shouldn't be redirected
106106
try {
@@ -121,7 +121,7 @@ public void doFilter(final ServletRequest request, final ServletResponse respons
121121
return;
122122
}
123123
}
124-
124+
125125
// A user is "always" authenticated by Jenkins as anonymous when not authenticated in any other way.
126126
if (SecurityContextHolder.getContext().getAuthentication() == null
127127
|| !SecurityContextHolder.getContext().getAuthentication().isAuthenticated()
@@ -135,10 +135,10 @@ public void doFilter(final ServletRequest request, final ServletResponse respons
135135
LOGGER.log(Level.FINEST, "Bypassing filter - already authenticated: " + requestUri);
136136
chain.doFilter(request, response); // just continue down the filter chain
137137
}
138-
138+
139139
//super.doFilter(request, response, chain); // This will also call the filter chaining
140140
}
141-
141+
142142
/**
143143
* Remove the hostname and the query string from a requested URI
144144
* @param requestURI the requested URI
@@ -150,10 +150,10 @@ static String cleanRequest(String requestURI) {
150150
// if the request URI has a query string, delete it.
151151
return requestURI.replaceAll("^https?://[^/]+/", "/").replaceAll("\\?.*$", "");
152152
}
153-
153+
154154
/**
155155
* Check a request URI to see if authentication should be attempted
156-
*
156+
*
157157
* If a path is unprotected or always readable, don't attempt to authenticate.
158158
* Attempting to authenticate causes problems with things like the cli and notifyCommit URIs
159159
* @param jenkins jenkins instance; accessible for testing purposes (for getUnprotectedRootActions())
@@ -169,7 +169,7 @@ static boolean shouldAttemptAuthentication(Jenkins jenkins, ServletRequest reque
169169
// but we only care about the exceptions to the permissions check.
170170
// Trying to use jenkins.getTarget() always seemed to test against anonymous or everyone permissions,
171171
// so the user was never automatically authenticated.
172-
172+
173173
// Code copied from Jenkins.getTarget(); need the rest, but not the permission check.
174174
String rest = cleanRequest(requestURI); //Stapler.getCurrentRequest().getRestOfPath() in Jenkins.getTarget()
175175

@@ -198,14 +198,14 @@ static boolean shouldAttemptAuthentication(Jenkins jenkins, ServletRequest reque
198198
private static boolean isAgentJnlpPath(String restOfPath, String prefix) {
199199
return restOfPath.matches("(/manage)?/computer/[^/]+/" + prefix + "-agent[.]jnlp");
200200
}
201-
201+
202202
private static boolean containsBypassHeader(ServletRequest request) {
203203
if (!(request instanceof HttpServletRequest)) {
204204
return false;
205205
}
206206
return ((HttpServletRequest)request).getHeader(BYPASS_HEADER) != null;
207207
}
208-
208+
209209
/**
210210
* @param doEnable if redirect should be enabled
211211
* @param redirectTo the site to redirect to
@@ -214,7 +214,7 @@ public void setRedirect(boolean doEnable, String redirectTo) {
214214
this.redirectEnabled = doEnable;
215215
this.redirect = redirectTo;
216216
}
217-
217+
218218
/**
219219
* @param allow if localhost should bypass the SSO authentication
220220
*/

src/main/java/com/github/farmgeek4life/jenkins/negotiatesso/NegSecUserSeedFilter.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2121
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222
* THE SOFTWARE.
23-
*
24-
* Portions of this code are based on the KerberosSSO plugin, also licensed
25-
* under the MIT License. See https://github.com/jenkinsci/kerberos-sso-plugin
23+
*
24+
* Portions of this code are based on the KerberosSSO plugin, also licensed
25+
* under the MIT License. See https://github.com/jenkinsci/kerberos-sso-plugin
2626
* for license details.
2727
*/
2828

@@ -68,10 +68,10 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
6868
WindowsPrincipal principal = (WindowsPrincipal) nrw.getUserPrincipal();
6969
authenticateJenkins(principal, (HttpServletRequest) request);
7070
}
71-
71+
7272
chain.doFilter(request, response);
7373
}
74-
74+
7575
/**
7676
* Perform the authentication methods for Jenkins
7777
*/
@@ -91,10 +91,10 @@ private void authenticateJenkins(WindowsPrincipal principal, HttpServletRequest
9191
userDetails.getPassword(),
9292
userDetails.getAuthorities());
9393
ACL.as2(authToken);
94-
populateUserSeed(httpRequest, userDetails.getUsername());
94+
populateUserSeed(httpRequest, userDetails.getUsername());
9595
SecurityListener.fireLoggedIn(userDetails.getUsername());
9696
}
97-
97+
9898
/**
9999
* This request is in a filter before the Stapler for pre-authentication for that reason we need to keep the code
100100
* that applies the same logic as UserSeedSecurityListener.
@@ -119,5 +119,5 @@ private void populateUserSeed(HttpServletRequest httpRequest, String username) {
119119
public void destroy() {
120120
// Nothing to do.
121121
}
122-
122+
123123
}

0 commit comments

Comments
 (0)