Profile and App events updated
parent
6f999bcedc
commit
08781a5f3a
@ -1,17 +1,36 @@
|
||||
package org.gcube.smartgears.security.defaults;
|
||||
|
||||
import org.gcube.common.validator.annotations.NotEmpty;
|
||||
import org.gcube.smartgears.security.AuthorizationProviderFactory;
|
||||
import org.gcube.smartgears.security.Credentials;
|
||||
import org.gcube.smartgears.security.SimpleCredentials;
|
||||
|
||||
public class DefaultAuthorizationProviderFactory implements AuthorizationProviderFactory<DefaultAuthorizationProvider>{
|
||||
|
||||
@NotEmpty
|
||||
private String endpoint;
|
||||
|
||||
@Override
|
||||
public DefaultAuthorizationProvider connect(Credentials credentials, String enpoint) {
|
||||
public DefaultAuthorizationProvider connect(Credentials credentials) {
|
||||
if (!SimpleCredentials.class.isInstance(credentials))
|
||||
throw new IllegalArgumentException("invalid credential type passed");
|
||||
return new DefaultAuthorizationProvider((SimpleCredentials)credentials, enpoint);
|
||||
if (this.endpoint == null || this.endpoint.isEmpty())
|
||||
throw new IllegalArgumentException("invalid enpoint passed");
|
||||
return new DefaultAuthorizationProvider((SimpleCredentials)credentials, this.endpoint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DefaultAuthorizationProviderFactory [endpoint=" + endpoint + "]";
|
||||
}
|
||||
|
||||
public String getEndpoint() {
|
||||
return endpoint;
|
||||
}
|
||||
|
||||
public void setEndpoint(String endpoint) {
|
||||
this.endpoint = endpoint;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue