use of gov.ca.cwds.service.oauth.UniversalUserTokenExtractor 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