-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #418 from olamy/fips-escapehatch
[JEP-237] disable escapeHatch when Jenkins is in FIPS mode
- Loading branch information
Showing
3 changed files
with
69 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/test/java/org/jenkinsci/plugins/oic/SecurityRealmConfigurationFIPSTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.jenkinsci.plugins.oic; | ||
|
||
import hudson.model.Descriptor; | ||
import org.junit.ClassRule; | ||
import org.junit.Test; | ||
import org.jvnet.hudson.test.FlagRule; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.is; | ||
|
||
public class SecurityRealmConfigurationFIPSTest { | ||
|
||
@ClassRule | ||
public static FlagRule<String> FIPS_RULE = FlagRule.systemProperty("jenkins.security.FIPS140.COMPLIANCE", "true"); | ||
|
||
@Test(expected = Descriptor.FormException.class) | ||
public void escapeHatchThrowsException() throws Exception { | ||
new OicSecurityRealm("clientId", null, null, null).setEscapeHatchEnabled(true); | ||
} | ||
|
||
@Test | ||
public void escapeHatchToFalse() throws Exception { | ||
OicSecurityRealm oicSecurityRealm = new OicSecurityRealm("clientId", null, null, null); | ||
oicSecurityRealm.setEscapeHatchEnabled(false); | ||
assertThat(oicSecurityRealm.isEscapeHatchEnabled(), is(false)); | ||
} | ||
|
||
@Test | ||
public void readresolve() throws Exception { | ||
OicSecurityRealm oicSecurityRealm = new OicSecurityRealm("clientId", null, null, null); | ||
oicSecurityRealm.setEscapeHatchEnabled(false); | ||
assertThat(oicSecurityRealm.isEscapeHatchEnabled(), is(false)); | ||
oicSecurityRealm.readResolve(); | ||
} | ||
} |