use of gov.ca.cwds.PerryProperties in project perry by ca-cwds.
the class WhiteListTest method testDisabled.
@Test
public void testDisabled() {
WhiteList whiteList = new WhiteList();
PerryProperties perryProperties = new PerryProperties();
perryProperties.setWhiteList("*");
whiteList.configuration = perryProperties;
whiteList.validate("", "url3");
}
use of gov.ca.cwds.PerryProperties in project perry by ca-cwds.
the class WhiteListTest method testEnabledValidUrl.
@Test
public void testEnabledValidUrl() {
WhiteList whiteList = new WhiteList();
PerryProperties perryProperties = new PerryProperties();
perryProperties.setWhiteList("url1 url2");
whiteList.configuration = perryProperties;
whiteList.validate("", "url1");
}
use of gov.ca.cwds.PerryProperties in project perry by ca-cwds.
the class WhiteListTest method testEnabledInvalidUrl.
@Test(expected = PerryException.class)
public void testEnabledInvalidUrl() {
WhiteList whiteList = new WhiteList();
PerryProperties perryProperties = new PerryProperties();
perryProperties.setWhiteList("url1 url2");
whiteList.configuration = perryProperties;
whiteList.validate("", "url3");
}
use of gov.ca.cwds.PerryProperties in project perry by ca-cwds.
the class UniversalUserTokenExtractorTest method test.
@Test
public void test() throws Exception {
PerryProperties perryProperties = new PerryProperties();
PerryProperties.IdentityProviderConfiguration identityProviderConfiguration = new PerryProperties.IdentityProviderConfiguration();
String path = Paths.get(getClass().getResource("/idp.groovy").toURI()).toString();
identityProviderConfiguration.setIdpMapping(path);
perryProperties.setIdentityProvider(identityProviderConfiguration);
UniversalUserTokenExtractor userTokenExtractor = new UniversalUserTokenExtractor();
userTokenExtractor.setConfiguration(perryProperties);
Map<String, Object> userInfo = new HashMap<>();
userInfo.put("safid.racfid", "racfid");
userInfo.put("ok", "true");
UniversalUserToken token = userTokenExtractor.extractPrincipal(userInfo);
assertEquals("racfid", token.getUserId());
}
Aggregations