Skip to content

Commit

Permalink
Merge branch 'develop' into test-jenkins-build
Browse files Browse the repository at this point in the history
  • Loading branch information
inigo-cobian committed Jun 20, 2024
2 parents f9e43d6 + 888664e commit a50b137
Show file tree
Hide file tree
Showing 10 changed files with 1,134 additions and 1,865 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.integratedmodelling.klab.api.runtime.monitoring.IMonitor;
import org.integratedmodelling.klab.auth.Authorization;
import org.integratedmodelling.klab.exceptions.KlabIOException;
import org.integratedmodelling.klab.exceptions.KlabMissingCredentialsException;
import org.integratedmodelling.klab.exceptions.KlabRemoteException;
import org.integratedmodelling.klab.rest.ExternalAuthenticationCredentials;
import org.integratedmodelling.klab.rest.Notification;
Expand Down Expand Up @@ -395,11 +396,12 @@ public void encodeSelf(String url) {
}

public OpenEO(String endpoint) {
this.endpoint = endpoint;
ExternalAuthenticationCredentials credentials = Authentication.INSTANCE.getCredentials(endpoint);
if (credentials != null) {
this.authorization = new Authorization(credentials);
if (credentials == null) {
throw new KlabMissingCredentialsException(endpoint);
}
this.endpoint = credentials.getURL();
this.authorization = new Authorization(credentials, endpoint);
this.executor.scheduleAtFixedRate(() -> {
Set<Job> finished = new HashSet<>();
for (Job job : jobs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class ExternalAuthenticationCredentials {
static {
parameterKeys = new HashMap<>();
parameterKeys.put("basic", new String[]{"username", "password"});
parameterKeys.put("oidc", new String[]{"url", "grant_type", "client_id", "client_secrets", "scope", "provider_id"});
parameterKeys.put("oidc", new String[]{"grant_type", "client_id", "client_secrets", "provider_id"});
parameterKeys.put("s3", new String[]{"accessKey", "secretKey"});
parameterKeys.put("key", new String[]{"key"});
}
Expand All @@ -24,7 +24,7 @@ public class ExternalAuthenticationCredentials {
* Credentials, depending on scheme
*
* for basic: username and password
* for oidc: Authentication URL, grant type, client ID, client secret, scope, provider
* for oidc: grant type, client ID, client secret, provider
* for s3: endpoint URL, access key, secret key
* for key: a single key
*/
Expand All @@ -35,6 +35,11 @@ public class ExternalAuthenticationCredentials {
*/
private String scheme = "basic";

/**
* The URL of the authentication service
*/
private String url = "";

public List<String> getCredentials() {
return credentials;
}
Expand All @@ -51,4 +56,11 @@ public void setScheme(String scheme) {
this.scheme = scheme;
}

public String getURL() {
return url;
}

public void setURL(String url) {
this.url = url;
}
}
28 changes: 15 additions & 13 deletions docs/highlightjs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a50b137

Please sign in to comment.