Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[JENKINS-36483] Removes spaces from the Domain
- Loading branch information
|
@@ -105,7 +105,7 @@ |
|
|
public GoogleOAuth2SecurityRealm(String clientId, String clientSecret, String domain) throws IOException { |
|
|
this.clientId = clientId; |
|
|
this.clientSecret = Secret.fromString(clientSecret); |
|
|
this.domain = Util.fixEmpty(domain); |
|
|
this.domain = Util.fixEmptyAndTrim(domain); |
|
|
} |
|
|
|
|
|
public String getClientId() { |
|
|
|
@@ -15,6 +15,20 @@ |
|
|
@Rule |
|
|
public JenkinsRule jenkins = new JenkinsRule(); |
|
|
|
|
|
@Test |
|
|
public void accidentallyBlank() throws IOException { |
|
|
GoogleOAuth2SecurityRealm instance = setupInstanceWithDomains(" "); |
|
|
assertTrue(instance.isDomainValid("acme.com")); |
|
|
assertTrue(instance.isDomainValid("mycompany.com")); |
|
|
} |
|
|
|
|
|
@Test |
|
|
public void trailingSpace() throws IOException { |
|
|
GoogleOAuth2SecurityRealm instance = setupInstanceWithDomains("acme.com "); |
|
|
assertTrue(instance.isDomainValid("acme.com")); |
|
|
assertFalse(instance.isDomainValid("mycompany.com")); |
|
|
} |
|
|
|
|
|
@Test |
|
|
public void validSingleDomain() throws IOException { |
|
|
GoogleOAuth2SecurityRealm instance = setupInstanceWithDomains("acme.com"); |
|
|