Skip to content

Commit deeae74

Browse files
authored
fix(jans-auth-server): corrected regression made in token request #2921 (#2922)
Fixes test failures on jenkins
1 parent ef26771 commit deeae74

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

jans-auth-server/client/src/main/java/io/jans/as/client/ClientAuthnEnabler.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import jakarta.ws.rs.client.Invocation.Builder;
1313
import jakarta.ws.rs.core.Form;
14+
import org.apache.commons.lang.StringUtils;
1415

1516

1617
/**
@@ -45,10 +46,12 @@ public void exec(ClientAuthnRequest request) {
4546
if (request.getAuthenticationMethod() == AuthenticationMethod.CLIENT_SECRET_JWT ||
4647
request.getAuthenticationMethod() == AuthenticationMethod.PRIVATE_KEY_JWT) {
4748
requestForm.param("client_assertion_type", ClientAssertionType.JWT_BEARER.toString());
48-
if (request.getClientAssertion() != null) {
49-
requestForm.param("client_assertion", request.getClientAssertion());
49+
50+
final String clientAssertion = request.getClientAssertion();
51+
if (clientAssertion != null) {
52+
requestForm.param("client_assertion", clientAssertion);
5053
}
51-
if (request.getAuthUsername() != null && !request.getAuthUsername().isEmpty()) {
54+
if (StringUtils.isNotBlank(request.getAuthUsername())) {
5255
requestForm.param("client_id", request.getAuthUsername());
5356
}
5457
}

jans-auth-server/client/src/main/java/io/jans/as/client/TokenRequest.java

+3-14
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ public class TokenRequest extends ClientAuthnRequest {
3838
private String codeVerifier;
3939
private String authReqId;
4040
private String deviceCode;
41-
private String audience;
4241
private String subjectToken;
4342
private String subjectTokenType;
4443
private String actorToken;
@@ -109,16 +108,6 @@ public void setRequestedTokenType(String requestedTokenType) {
109108
this.requestedTokenType = requestedTokenType;
110109
}
111110

112-
@Override
113-
public String getAudience() {
114-
return audience;
115-
}
116-
117-
@Override
118-
public void setAudience(String audience) {
119-
this.audience = audience;
120-
}
121-
122111
/**
123112
* Returns the grant type.
124113
*
@@ -325,7 +314,7 @@ public String getQueryString() {
325314
builder.append("refresh_token", refreshToken);
326315
builder.append("auth_req_id", authReqId);
327316
builder.append("device_code", deviceCode);
328-
builder.append("audience", audience);
317+
builder.append("audience", getAudience());
329318
builder.append("subject_token", subjectToken);
330319
builder.append("subject_token_type", subjectTokenType);
331320
builder.append("actor_token", actorToken);
@@ -360,8 +349,8 @@ public Map<String, String> getParameters() {
360349
if (username != null && !username.isEmpty()) {
361350
parameters.put("username", username);
362351
}
363-
if (StringUtils.isNotBlank(audience)) {
364-
parameters.put("audience", audience);
352+
if (StringUtils.isNotBlank(getAudience())) {
353+
parameters.put("audience", getAudience());
365354
}
366355
if (StringUtils.isNotBlank(subjectToken)) {
367356
parameters.put("subject_token", subjectToken);

0 commit comments

Comments
 (0)