Package org.gcube.documentstore.security
Class LibraryCredentials
java.lang.Object
org.gcube.documentstore.security.LibraryCredentials
Runs the library's own tasks (sending records, flushing, rediscovering the persistence, elaborating
the fallback file, reloading a configuration) with the library's own credentials: the secret of the
working Context obtained from
dsl.yaml (LibraryConfigurationBinder), never the secret
that a pool thread happens to carry.
When dsl.yaml is not available (the library is used outside a SmartGears container), the task
runs with the secret already set in the calling thread, as the library always did.
- Author:
- Luca Frosini (ISTI - CNR)
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TRuns a task with the library's credentials, or with the calling thread's secret if the library has none.static org.gcube.common.security.secrets.SecretReturns a secret for the library's working Context.static booleanTells whether the library has credentials of its own, i.e. whetherdsl.yamlprovides an authorization provider.static voidRuns a task with the library's credentials, or with the calling thread's secret if the library has none.
-
Method Details
-
getSecret
public static org.gcube.common.security.secrets.Secret getSecret()Returns a secret for the library's working Context.- Returns:
- the secret, or
nullif the library has no credentials of its own
-
isAvailable
public static boolean isAvailable()Tells whether the library has credentials of its own, i.e. whetherdsl.yamlprovides an authorization provider.- Returns:
trueif the library has credentials of its own
-
call
Runs a task with the library's credentials, or with the calling thread's secret if the library has none.- Type Parameters:
T- the result type- Parameters:
task- the task- Returns:
- the task's result
- Throws:
Exception- if the task fails
-
run
Runs a task with the library's credentials, or with the calling thread's secret if the library has none.- Parameters:
task- the task
-