diff --git a/pom.xml b/pom.xml index a8ad4a2..e8cd18d 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ 1.24 -SNAPSHOT - 2.492 + 2.504 ${jenkins.baseline}.3 Max Low @@ -46,7 +46,7 @@ scm:git:https://github.com/${gitHubRepo}.git scm:git:git@github.com:${gitHubRepo}.git https://github.com/${gitHubRepo} - gitlab-oauth-1.23 + ${scmTag} @@ -55,6 +55,10 @@ repo.jenkins-ci.org https://repo.jenkins-ci.org/public/ + + incrementals + https://repo.jenkins-ci.org/incrementals/ + @@ -67,7 +71,7 @@ io.jenkins.tools.bom bom-${jenkins.baseline}.x - 5473.vb_9533d9e5d88 + 5577.vea_979d35b_b_ff import pom @@ -89,8 +93,12 @@ io.jenkins.plugins gitlab-api - - 5.8.1-106.vef1de800710e + + 6.1.0-124.v711d0eda_59a_8 + + + io.jenkins.plugins + jakarta-xml-bind-api org.jenkins-ci.plugins diff --git a/src/main/java/org/jenkinsci/plugins/GitLabAuthenticationToken.java b/src/main/java/org/jenkinsci/plugins/GitLabAuthenticationToken.java index 3872548..cf474a4 100755 --- a/src/main/java/org/jenkinsci/plugins/GitLabAuthenticationToken.java +++ b/src/main/java/org/jenkinsci/plugins/GitLabAuthenticationToken.java @@ -43,12 +43,12 @@ of this software and associated documentation files (the "Software"), to deal import jenkins.model.Jenkins; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; -import org.gitlab4j.api.Constants.TokenType; import org.gitlab4j.api.GitLabApi; import org.gitlab4j.api.GitLabApiException; import org.gitlab4j.api.models.Group; import org.gitlab4j.api.models.Project; import org.gitlab4j.api.models.User; +import org.gitlab4j.models.Constants.TokenType; import org.springframework.security.authentication.AbstractAuthenticationToken; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; diff --git a/src/main/java/org/jenkinsci/plugins/GitLabSecurityRealm.java b/src/main/java/org/jenkinsci/plugins/GitLabSecurityRealm.java index 007c164..5dcc2af 100644 --- a/src/main/java/org/jenkinsci/plugins/GitLabSecurityRealm.java +++ b/src/main/java/org/jenkinsci/plugins/GitLabSecurityRealm.java @@ -72,9 +72,9 @@ import org.apache.http.impl.client.HttpClients; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; -import org.gitlab4j.api.Constants.TokenType; import org.gitlab4j.api.GitLabApiException; import org.gitlab4j.api.models.Group; +import org.gitlab4j.models.Constants.TokenType; import org.jfree.util.Log; import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.Header; diff --git a/src/test/java/org/jenkinsci/plugins/GitLabAuthenticationTokenTest.java b/src/test/java/org/jenkinsci/plugins/GitLabAuthenticationTokenTest.java new file mode 100644 index 0000000..03afbe5 --- /dev/null +++ b/src/test/java/org/jenkinsci/plugins/GitLabAuthenticationTokenTest.java @@ -0,0 +1,44 @@ +/* + The MIT License + + Copyright (c) 2025 Jenkins 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 + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + */ + +package org.jenkinsci.plugins; + +import static org.junit.jupiter.api.Assertions.assertThrows; + +import org.gitlab4j.api.GitLabApiException; +import org.gitlab4j.models.Constants; +import org.junit.jupiter.api.Test; + +public class GitLabAuthenticationTokenTest { + + /** + * This checks that we get the correct exception. + */ + @Test + public void testInvalidUrl() { + assertThrows(GitLabApiException.class, + () -> new GitLabAuthenticationToken("42", + "http://localhost/_invalid_url", Constants.TokenType.ACCESS)); + } +}