Skip to content

Commit e352848

Browse files
author
Alexander
authored
Merge pull request jenkinsci#1 from Vlatombe/authentication-tokens
Depend on new kubernetes-client-api and some fixes for TokenSource
2 parents 754f7ff + d883e1b commit e352848

File tree

4 files changed

+22
-34
lines changed

4 files changed

+22
-34
lines changed

pom.xml

+12-31
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,12 @@
4040
<java.level>8</java.level>
4141

4242
<!-- dependency versions -->
43-
<jenkins.version>2.60.3</jenkins.version>
43+
<jenkins.version>2.176.1</jenkins.version>
4444

4545
<slf4j.version>1.7.26</slf4j.version>
4646

4747
<!-- jenkins plugins versions -->
48-
<jenkins-credentials.version>2.1.16</jenkins-credentials.version>
4948
<jenkins-structs.version>1.19</jenkins-structs.version>
50-
<jenkins-plain-credentials.version>1.3</jenkins-plain-credentials.version>
5149

5250
<!-- maven plugins versions -->
5351
<maven-coveralls.version>4.3.0</maven-coveralls.version>
@@ -58,27 +56,10 @@
5856

5957
<dependencies>
6058
<dependency>
61-
<groupId>io.fabric8</groupId>
62-
<artifactId>kubernetes-client</artifactId>
63-
<version>${kubernetes-client.version}</version>
64-
<exclusions>
65-
<!-- Jackson logic comes from plugins -->
66-
<exclusion>
67-
<groupId>com.fasterxml.jackson.core</groupId>
68-
<artifactId>jackson-core</artifactId>
69-
</exclusion>
70-
<exclusion>
71-
<groupId>com.fasterxml.jackson.core</groupId>
72-
<artifactId>jackson-databind</artifactId>
73-
</exclusion>
74-
</exclusions>
75-
</dependency>
76-
<dependency>
77-
<groupId>io.fabric8</groupId>
78-
<artifactId>openshift-client</artifactId>
79-
<version>${kubernetes-client.version}</version>
59+
<groupId>org.jenkins-ci.plugins</groupId>
60+
<artifactId>kubernetes-client-api</artifactId>
61+
<version>1.0.0</version>
8062
</dependency>
81-
8263
<dependency>
8364
<groupId>org.jenkins-ci.plugins</groupId>
8465
<artifactId>jackson2-api</artifactId>
@@ -102,13 +83,11 @@
10283
<dependency>
10384
<groupId>org.jenkins-ci.plugins</groupId>
10485
<artifactId>credentials</artifactId>
105-
<version>${jenkins-credentials.version}</version>
10686
</dependency>
10787
<!-- to use StringCredentialsImpl for tokens -->
10888
<dependency>
10989
<groupId>org.jenkins-ci.plugins</groupId>
11090
<artifactId>plain-credentials</artifactId>
111-
<version>${jenkins-plain-credentials.version}</version>
11291
</dependency>
11392
<dependency>
11493
<groupId>org.jenkins-ci.plugins</groupId>
@@ -132,14 +111,16 @@
132111
<dependencyManagement>
133112
<dependencies>
134113
<dependency>
135-
<groupId>org.jenkins-ci.plugins</groupId>
136-
<artifactId>structs</artifactId>
137-
<version>${jenkins-structs.version}</version>
114+
<groupId>io.jenkins.tools.bom</groupId>
115+
<artifactId>bom</artifactId>
116+
<version>2.176.2</version>
117+
<scope>import</scope>
118+
<type>pom</type>
138119
</dependency>
139120
<dependency>
140-
<groupId>org.jenkins-ci.plugins</groupId>
141-
<artifactId>ssh-credentials</artifactId>
142-
<version>1.12</version>
121+
<groupId>commons-io</groupId>
122+
<artifactId>commons-io</artifactId>
123+
<version>2.6</version>
143124
</dependency>
144125
</dependencies>
145126
</dependencyManagement>

src/main/java/org/jenkinsci/plugins/kubernetes/credentials/FileCredentialsTokenSource.java

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.jenkinsci.plugins.kubernetes.credentials;
22

33
import edu.umd.cs.findbugs.annotations.NonNull;
4+
import hudson.Extension;
45
import jenkins.authentication.tokens.api.AuthenticationTokenException;
56
import jenkins.authentication.tokens.api.AuthenticationTokenSource;
67
import org.apache.commons.io.IOUtils;
@@ -11,6 +12,7 @@
1112
import java.io.InputStream;
1213
import java.nio.charset.StandardCharsets;
1314

15+
@Extension
1416
public class FileCredentialsTokenSource extends AuthenticationTokenSource<KubernetesAuthKubeconfig, FileCredentials> {
1517
public FileCredentialsTokenSource() {
1618
super(KubernetesAuthKubeconfig.class, FileCredentials.class);

src/main/java/org/jenkinsci/plugins/kubernetes/credentials/StringCredentialsTokenSource.java

+2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package org.jenkinsci.plugins.kubernetes.credentials;
22

33
import edu.umd.cs.findbugs.annotations.NonNull;
4+
import hudson.Extension;
45
import jenkins.authentication.tokens.api.AuthenticationTokenException;
56
import jenkins.authentication.tokens.api.AuthenticationTokenSource;
67
import org.jenkinsci.plugins.kubernetes.auth.KubernetesAuthToken;
78
import org.jenkinsci.plugins.plaincredentials.StringCredentials;
89

10+
@Extension
911
public class StringCredentialsTokenSource extends AuthenticationTokenSource<KubernetesAuthToken, StringCredentials> {
1012
public StringCredentialsTokenSource() {
1113
super(KubernetesAuthToken.class, StringCredentials.class);

src/main/java/org/jenkinsci/plugins/kubernetes/credentials/UsernamePasswordCredentialsTokenSource.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
package org.jenkinsci.plugins.kubernetes.credentials;
22

3+
import com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials;
34
import com.cloudbees.plugins.credentials.common.UsernamePasswordCredentials;
45
import edu.umd.cs.findbugs.annotations.NonNull;
6+
import hudson.Extension;
57
import jenkins.authentication.tokens.api.AuthenticationTokenException;
68
import jenkins.authentication.tokens.api.AuthenticationTokenSource;
79
import org.jenkinsci.plugins.kubernetes.auth.KubernetesAuthUsernamePassword;
810

9-
public class UsernamePasswordCredentialsTokenSource extends AuthenticationTokenSource<KubernetesAuthUsernamePassword, UsernamePasswordCredentials> {
11+
@Extension
12+
public class UsernamePasswordCredentialsTokenSource extends AuthenticationTokenSource<KubernetesAuthUsernamePassword, StandardUsernamePasswordCredentials> {
1013
public UsernamePasswordCredentialsTokenSource() {
11-
super(KubernetesAuthUsernamePassword.class, UsernamePasswordCredentials.class);
14+
super(KubernetesAuthUsernamePassword.class, StandardUsernamePasswordCredentials.class);
1215
}
1316

1417
@NonNull
1518
@Override
16-
public KubernetesAuthUsernamePassword convert(@NonNull UsernamePasswordCredentials credential) throws AuthenticationTokenException {
19+
public KubernetesAuthUsernamePassword convert(@NonNull StandardUsernamePasswordCredentials credential) throws AuthenticationTokenException {
1720
return new KubernetesAuthUsernamePassword(
1821
credential.getUsername(),
1922
credential.getPassword().getPlainText()

0 commit comments

Comments
 (0)