Skip to content

Commit 74902c3

Browse files
committed
No need to contact controller just to get appID
1 parent 22ef38d commit 74902c3

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubAppCredentials.java

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,13 @@ private static final class AgentSide extends BaseStandardCredentials implements
195195

196196
static final String SEP = "%%%";
197197

198+
private final String appID;
198199
private final String data;
199200
private transient Channel ch;
200201

201202
AgentSide(GitHubAppCredentials onMaster) {
202203
super(onMaster.getScope(), onMaster.getId(), onMaster.getDescription());
204+
appID = onMaster.appID;
203205
data = Secret.fromString(onMaster.appID + SEP + onMaster.privateKey.getPlainText() + SEP + onMaster.actualApiUri() + SEP + onMaster.owner).getEncryptedValue();
204206
}
205207

@@ -210,11 +212,7 @@ private Object readResolve() {
210212

211213
@Override
212214
public String getUsername() {
213-
try {
214-
return ch.call(new GetUsername(data));
215-
} catch (IOException | InterruptedException x) {
216-
throw new RuntimeException(x);
217-
}
215+
return appID;
218216
}
219217

220218
@Override
@@ -226,21 +224,6 @@ public Secret getPassword() {
226224
}
227225
}
228226

229-
private static final class GetUsername extends SlaveToMasterCallable<String, RuntimeException> {
230-
231-
private final String data;
232-
233-
GetUsername(String data) {
234-
this.data = data;
235-
}
236-
237-
@Override
238-
public String call() throws RuntimeException {
239-
return Secret.fromString(data).getPlainText().split(SEP)[0];
240-
}
241-
242-
}
243-
244227
private static final class GetPassword extends SlaveToMasterCallable<String, RuntimeException> {
245228

246229
private final String data;

0 commit comments

Comments
 (0)