Class AuthorizationSection

java.lang.Object
org.gcube.common.security.provider.AuthorizationSection

public final class AuthorizationSection extends Object
The authorization section of a YAML configuration file, e.g. container.yaml of SmartGears or dsl.yaml of document-store-lib, and the provider of authorization it gives:
 authorization:
   factory:
     endpoint: https://accounts.d4science.org/auth/realms/d4science/protocol/openid-connect/token
   credentials:
     clientID: node.d4science.org
     secret: "..."
 
factory and credentials may name in class the class to create: DefaultAuthorizationProviderFactory and SimpleCredentials by default. Their other keys are the properties of that class; a key that is not one of them is ignored.
Author:
Luca Frosini (ISTI-CNR)
  • Field Details

  • Method Details

    • configuration

      public static AuthorizationSection.Configuration configuration(Map<?,?> authorization)
      Returns the factory and the credentials of a section.
      Parameters:
      authorization - the section, as YAML reads it
      Returns:
      its configuration
      Throws:
      IllegalArgumentException - if a class cannot be created or a value does not fit its property
    • provider

      public static org.gcube.common.security.factories.AuthorizationProvider provider(Map<?,?> authorization)
      Returns the provider of authorization of a section.
      Parameters:
      authorization - the section, as YAML reads it
      Returns:
      the provider
    • read

      public static org.gcube.common.security.factories.AuthorizationProvider read(Path file) throws Exception
      Returns the provider of authorization of the "authorization" section of a YAML file.
      Parameters:
      file - the file
      Returns:
      the provider
      Throws:
      IllegalArgumentException - if the file has no such section, or it is not valid
      Exception - if the file cannot be read