Search in sources :

Example 1 with GoogleOAuth2AP

use of edu.harvard.iq.dataverse.authorization.providers.oauth2.impl.GoogleOAuth2AP 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)

Example 2 with GoogleOAuth2AP

use of edu.harvard.iq.dataverse.authorization.providers.oauth2.impl.GoogleOAuth2AP in project dataverse by IQSS.

the class AuthenticationServiceBean method getAuthenticationProviderIdsSorted.

/**
 * @todo Consider making the sort order configurable by making it a colum on
 * AuthenticationProviderRow
 */
public List<String> getAuthenticationProviderIdsSorted() {
    GitHubOAuth2AP github = new GitHubOAuth2AP(null, null);
    GoogleOAuth2AP google = new GoogleOAuth2AP(null, null);
    return Arrays.asList(BuiltinAuthenticationProvider.PROVIDER_ID, ShibAuthenticationProvider.PROVIDER_ID, OrcidOAuth2AP.PROVIDER_ID_PRODUCTION, OrcidOAuth2AP.PROVIDER_ID_SANDBOX, github.getId(), google.getId());
}
Also used : GoogleOAuth2AP(edu.harvard.iq.dataverse.authorization.providers.oauth2.impl.GoogleOAuth2AP) GitHubOAuth2AP(edu.harvard.iq.dataverse.authorization.providers.oauth2.impl.GitHubOAuth2AP)

Aggregations

GitHubOAuth2AP (edu.harvard.iq.dataverse.authorization.providers.oauth2.impl.GitHubOAuth2AP)2 GoogleOAuth2AP (edu.harvard.iq.dataverse.authorization.providers.oauth2.impl.GoogleOAuth2AP)2 BuiltinAuthenticationProvider (edu.harvard.iq.dataverse.authorization.providers.builtin.BuiltinAuthenticationProvider)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