Skip to content

Commit c23a1da

Browse files
committed
Handle missing force setting in config.xml
1 parent 4a5f987 commit c23a1da

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/main/java/org/jenkinsci/plugins/GithubSecurityRealm.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ public class GithubSecurityRealm extends AbstractPasswordBasedSecurityRealm impl
108108
private static final String DEFAULT_API_URI = "https://api.github.com";
109109
private static final String DEFAULT_ENTERPRISE_API_SUFFIX = "/api/v3";
110110
private static final String DEFAULT_OAUTH_SCOPES = "read:org,user:email";
111+
private static final Boolean DEFAULT_FORCE_GITHUB_EMAIL = false;
111112

112113
private String githubWebUri;
113114
private String githubApiUri;
@@ -320,6 +321,10 @@ public Object unmarshal(HierarchicalStreamReader reader,
320321
realm.setGithubApiUri(DEFAULT_API_URI);
321322
}
322323

324+
if (realm.getForceGithubEmail() == null) {
325+
realm.setForceGithubEmail(DEFAULT_FORCE_GITHUB_EMAIL);
326+
}
327+
323328
return realm;
324329
}
325330

@@ -696,6 +701,10 @@ public String getDefaultOauthScopes() {
696701
return DEFAULT_OAUTH_SCOPES;
697702
}
698703

704+
public Boolean getDefaultForceGithubEmail() {
705+
return DEFAULT_FORCE_GITHUB_EMAIL;
706+
}
707+
699708
public DescriptorImpl() {
700709
super();
701710
// TODO Auto-generated constructor stub

0 commit comments

Comments
 (0)