Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(jans-auth-server): corrected regression made in token request #2921 #2922

Merged
merged 1 commit into from
Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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