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));
}
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());
}
Aggregations