2022-05-25 18:56:42 +02:00
|
|
|
package org.gcube.smartgears.security.defaults;
|
|
|
|
|
|
|
|
import org.gcube.smartgears.security.AuthorizationProviderFactory;
|
|
|
|
import org.gcube.smartgears.security.Credentials;
|
|
|
|
import org.gcube.smartgears.security.SimpleCredentials;
|
|
|
|
|
|
|
|
public class DefaultAuthorizationProviderFactory implements AuthorizationProviderFactory<DefaultAuthorizationProvider>{
|
|
|
|
|
|
|
|
@Override
|
2022-05-26 14:39:31 +02:00
|
|
|
public DefaultAuthorizationProvider connect(Credentials credentials, String enpoint) {
|
2022-05-25 18:56:42 +02:00
|
|
|
if (!SimpleCredentials.class.isInstance(credentials))
|
|
|
|
throw new IllegalArgumentException("invalid credential type passed");
|
2022-05-26 14:39:31 +02:00
|
|
|
return new DefaultAuthorizationProvider((SimpleCredentials)credentials, enpoint);
|
2022-05-25 18:56:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|