diff --git a/src/main/java/com/microsoft/jenkins/azuread/AzureSecurityRealm.java b/src/main/java/com/microsoft/jenkins/azuread/AzureSecurityRealm.java
index c16c5c4..e8911a7 100644
--- a/src/main/java/com/microsoft/jenkins/azuread/AzureSecurityRealm.java
+++ b/src/main/java/com/microsoft/jenkins/azuread/AzureSecurityRealm.java
@@ -121,6 +121,7 @@ public class AzureSecurityRealm extends SecurityRealm {
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";
@@ -137,6 +138,7 @@ public class AzureSecurityRealm extends SecurityRealm {
private boolean disableGraphIntegration;
private String azureEnvironmentName = "Azure";
private String credentialType = "Secret";
+ private String domainHint = "";
public AccessToken getAccessToken() {
TokenRequestContext tokenRequestContext = new TokenRequestContext();
@@ -192,6 +194,15 @@ public void setPromptAccount(boolean promptAccount) {
this.promptAccount = promptAccount;
}
+ public String getDomainHint() {
+ return domainHint;
+ }
+
+ @DataBoundSetter
+ public void setDomainHint(String domainHint) {
+ this.domainHint = domainHint;
+ }
+
public boolean isSingleLogout() {
return singleLogout;
}
@@ -371,6 +382,9 @@ public HttpResponse doCommenceLogin(StaplerRequest request, @Header("Referer") f
if (promptAccount) {
additionalParams.put("prompt", "select_account");
}
+ if (!StringUtils.isBlank(domainHint)) {
+ additionalParams.put("domain_hint", domainHint);
+ }
return new HttpRedirect(service.getAuthorizationUrl(additionalParams));
}
@@ -702,6 +716,10 @@ public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingC
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
@@ -745,6 +763,9 @@ public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext co
case CONVERTER_SINGLE_LOGOUT:
realm.setSingleLogout(Boolean.parseBoolean(value));
break;
+ case CONVERTER_DOMAIN_HINT:
+ realm.setDomainHint(value);
+ break;
default:
break;
}
diff --git a/src/main/resources/com/microsoft/jenkins/azuread/AzureSecurityRealm/config.jelly b/src/main/resources/com/microsoft/jenkins/azuread/AzureSecurityRealm/config.jelly
index 019252e..bb8da71 100644
--- a/src/main/resources/com/microsoft/jenkins/azuread/AzureSecurityRealm/config.jelly
+++ b/src/main/resources/com/microsoft/jenkins/azuread/AzureSecurityRealm/config.jelly
@@ -30,30 +30,35 @@
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+