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

feat: optionally add domain_hint #628

Merged
merged 2 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -121,6 +121,7 @@
public static final String CONVERTER_DISABLE_GRAPH_INTEGRATION = "disableGraphIntegration";
public static final String CONVERTER_SINGLE_LOGOUT = "singleLogout";
public static final String CONVERTER_PROMPT_ACCOUNT = "promptAccount";
public static final String CONVERTER_DOMAIN_HINT = "domainHint";

public static final String CONVERTER_ENVIRONMENT_NAME = "environmentName";

Expand All @@ -137,6 +138,7 @@
private boolean disableGraphIntegration;
private String azureEnvironmentName = "Azure";
private String credentialType = "Secret";
private String domainHint = "";

public AccessToken getAccessToken() {
TokenRequestContext tokenRequestContext = new TokenRequestContext();
Expand Down Expand Up @@ -192,6 +194,15 @@
this.promptAccount = promptAccount;
}

public String getDomainHint() {
return domainHint;
}

@DataBoundSetter
public void setDomainHint(String domainHint) {
this.domainHint = domainHint;
}

public boolean isSingleLogout() {
return singleLogout;
}
Expand Down Expand Up @@ -371,6 +382,9 @@
if (promptAccount) {
additionalParams.put("prompt", "select_account");
}
if (!StringUtils.isBlank(domainHint)) {
additionalParams.put("domain_hint", domainHint);

Check warning on line 386 in src/main/java/com/microsoft/jenkins/azuread/AzureSecurityRealm.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 385-386 are not covered by tests
}

return new HttpRedirect(service.getAuthorizationUrl(additionalParams));
}
Expand Down Expand Up @@ -702,6 +716,10 @@
writer.startNode(CONVERTER_SINGLE_LOGOUT);
writer.setValue(String.valueOf(realm.isSingleLogout()));
writer.endNode();

writer.startNode(CONVERTER_DOMAIN_HINT);
writer.setValue(String.valueOf(realm.getDomainHint()));
writer.endNode();
}

@Override
Expand Down Expand Up @@ -745,6 +763,9 @@
case CONVERTER_SINGLE_LOGOUT:
realm.setSingleLogout(Boolean.parseBoolean(value));
break;
case CONVERTER_DOMAIN_HINT:
realm.setDomainHint(value);
break;
default:
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
<f:checkbox />
</f:entry>

<f:entry title="${%Domain Hint: The realm of the user in a federated directory}" field="domainHint">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the label would normally just be the field name and then either a description or help text to explain what its for

<f:textbox />
</f:entry>

<f:entry title="${%Enable Single Logout}" field="singleLogout">
<f:checkbox />
Expand Down
Loading