Class DefaultAuthorizationProvider

java.lang.Object
org.gcube.smartgears.security.defaults.DefaultAuthorizationProvider
All Implemented Interfaces:
org.gcube.common.security.factories.AuthorizationProvider

public class DefaultAuthorizationProvider extends Object implements org.gcube.common.security.factories.AuthorizationProvider
Default implementation of an authorization provider, obtaining the container's tokens from the D4Science IAM through D4ScienceIAMClient.
Author:
Luca Frosini (ISTI-CNR)
  • Constructor Details

    • DefaultAuthorizationProvider

      public DefaultAuthorizationProvider(SimpleCredentials credentials, String endpoint)
  • Method Details

    • getContexts

      public Set<String> getContexts()
      Specified by:
      getContexts in interface org.gcube.common.security.factories.AuthorizationProvider
    • getSecretForContext

      public org.gcube.common.security.secrets.Secret getSecretForContext(String context)
      Returns a secret whose token is restricted to the given Context, requested for the container's client.
      Specified by:
      getSecretForContext in interface org.gcube.common.security.factories.AuthorizationProvider
      Parameters:
      context - the Context the token must be restricted to
      Returns:
      the secret holding the restricted token
      Throws:
      RuntimeException - if the token cannot be obtained, or if the IAM returns a token not restricted to context, which happens when the client is not a member of it
    • getCredentials

      @Deprecated public SimpleCredentials getCredentials()
      Deprecated.
      Specified by:
      getCredentials in interface org.gcube.common.security.factories.AuthorizationProvider