Skip to content

Commit

Permalink
fix(jans-auth-server): corrected regression made in token request #2921
Browse files Browse the repository at this point in the history
Fixes test failures on jenkins
  • Loading branch information
yuriyz committed Nov 8, 2022
1 parent ef26771 commit e04101c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import jakarta.ws.rs.client.Invocation.Builder;
import jakarta.ws.rs.core.Form;
import org.apache.commons.lang.StringUtils;


/**
Expand Down Expand Up @@ -45,10 +46,12 @@ public void exec(ClientAuthnRequest request) {
if (request.getAuthenticationMethod() == AuthenticationMethod.CLIENT_SECRET_JWT ||
request.getAuthenticationMethod() == AuthenticationMethod.PRIVATE_KEY_JWT) {
requestForm.param("client_assertion_type", ClientAssertionType.JWT_BEARER.toString());
if (request.getClientAssertion() != null) {
requestForm.param("client_assertion", request.getClientAssertion());

final String clientAssertion = request.getClientAssertion();
if (clientAssertion != null) {
requestForm.param("client_assertion", clientAssertion);
}
if (request.getAuthUsername() != null && !request.getAuthUsername().isEmpty()) {
if (StringUtils.isNotBlank(request.getAuthUsername())) {
requestForm.param("client_id", request.getAuthUsername());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public class TokenRequest extends ClientAuthnRequest {
private String codeVerifier;
private String authReqId;
private String deviceCode;
private String audience;
private String subjectToken;
private String subjectTokenType;
private String actorToken;
Expand Down Expand Up @@ -109,16 +108,6 @@ public void setRequestedTokenType(String requestedTokenType) {
this.requestedTokenType = requestedTokenType;
}

@Override
public String getAudience() {
return audience;
}

@Override
public void setAudience(String audience) {
this.audience = audience;
}

/**
* Returns the grant type.
*
Expand Down Expand Up @@ -325,7 +314,7 @@ public String getQueryString() {
builder.append("refresh_token", refreshToken);
builder.append("auth_req_id", authReqId);
builder.append("device_code", deviceCode);
builder.append("audience", audience);
builder.append("audience", getAudience());
builder.append("subject_token", subjectToken);
builder.append("subject_token_type", subjectTokenType);
builder.append("actor_token", actorToken);
Expand Down Expand Up @@ -360,8 +349,8 @@ public Map<String, String> getParameters() {
if (username != null && !username.isEmpty()) {
parameters.put("username", username);
}
if (StringUtils.isNotBlank(audience)) {
parameters.put("audience", audience);
if (StringUtils.isNotBlank(getAudience())) {
parameters.put("audience", getAudience());
}
if (StringUtils.isNotBlank(subjectToken)) {
parameters.put("subject_token", subjectToken);
Expand Down

0 comments on commit e04101c

Please sign in to comment.