Class AuthorizationSection
java.lang.Object
org.gcube.common.security.provider.AuthorizationSection
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)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordThe factory and the credentials a section gives. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionconfiguration(Map<?, ?> authorization) Returns the factory and the credentials of a section.static org.gcube.common.security.factories.AuthorizationProviderReturns the provider of authorization of a section.static org.gcube.common.security.factories.AuthorizationProviderReturns the provider of authorization of the "authorization" section of a YAML file.
-
Field Details
-
SECTION
The name of the section.- See Also:
-
CLASS
The key naming the class to create.- See Also:
-
FACTORY
The key of the factory of the provider.- See Also:
-
CREDENTIALS
The key of the credentials.- See Also:
-
-
Method Details
-
configuration
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 validException- if the file cannot be read
-