Search in sources :

Example 1 with OrcidOAuth2AP

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));
}
Also used : ShibAuthenticationProvider(edu.harvard.iq.dataverse.authorization.providers.shib.ShibAuthenticationProvider) GoogleOAuth2AP(edu.harvard.iq.dataverse.authorization.providers.oauth2.impl.GoogleOAuth2AP) OrcidOAuth2AP(edu.harvard.iq.dataverse.authorization.providers.oauth2.impl.OrcidOAuth2AP) BuiltinAuthenticationProvider(edu.harvard.iq.dataverse.authorization.providers.builtin.BuiltinAuthenticationProvider) ShibAuthenticationProvider(edu.harvard.iq.dataverse.authorization.providers.shib.ShibAuthenticationProvider) BuiltinAuthenticationProvider(edu.harvard.iq.dataverse.authorization.providers.builtin.BuiltinAuthenticationProvider) GitHubOAuth2AP(edu.harvard.iq.dataverse.authorization.providers.oauth2.impl.GitHubOAuth2AP) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

BuiltinAuthenticationProvider (edu.harvard.iq.dataverse.authorization.providers.builtin.BuiltinAuthenticationProvider)1 GitHubOAuth2AP (edu.harvard.iq.dataverse.authorization.providers.oauth2.impl.GitHubOAuth2AP)1 GoogleOAuth2AP (edu.harvard.iq.dataverse.authorization.providers.oauth2.impl.GoogleOAuth2AP)1 OrcidOAuth2AP (edu.harvard.iq.dataverse.authorization.providers.oauth2.impl.OrcidOAuth2AP)1 ShibAuthenticationProvider (edu.harvard.iq.dataverse.authorization.providers.shib.ShibAuthenticationProvider)1 HashSet (java.util.HashSet)1 Test (org.junit.Test)1