use of edu.harvard.iq.dataverse.authorization.providers.oauth2.impl.OrcidOAuth2AP in project dataverse by IQSS.
the class AuthUtilTest method testIsNonLocalLoginEnabled.
/**
* Test of isNonLocalLoginEnabled method, of class AuthUtil.
*/
@Test
public void testIsNonLocalLoginEnabled() {
System.out.println("isNonLocalLoginEnabled");
AuthUtil authUtil = new AuthUtil();
assertEquals(false, AuthUtil.isNonLocalLoginEnabled(null));
Collection<AuthenticationProvider> shibOnly = new HashSet<>();
shibOnly.add(new ShibAuthenticationProvider());
assertEquals(true, AuthUtil.isNonLocalLoginEnabled(shibOnly));
Collection<AuthenticationProvider> manyNonLocal = new HashSet<>();
manyNonLocal.add(new ShibAuthenticationProvider());
manyNonLocal.add(new GitHubOAuth2AP(null, null));
manyNonLocal.add(new GoogleOAuth2AP(null, null));
manyNonLocal.add(new OrcidOAuth2AP(null, null, null));
assertEquals(true, AuthUtil.isNonLocalLoginEnabled(manyNonLocal));
Collection<AuthenticationProvider> onlyBuiltin = new HashSet<>();
onlyBuiltin.add(new BuiltinAuthenticationProvider(null, null));
// only builtin provider
assertEquals(false, AuthUtil.isNonLocalLoginEnabled(onlyBuiltin));
}
Aggregations