Class Secret
java.lang.Object
org.gcube.common.security.secrets.Secret
An abstract class representing a secret used for authorization.
A secret encapsulates sensitive information required to authenticate an
Owner and authorize access to resources within a specific context.
This class provides a contract for retrieving key security attributes
such as the owner, context, and HTTP authorization headers, while also
offering methods to check the secret's validity and expiration status.
- Author:
- Luca Frosini (ISTI - CNR)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract StringRetrieves the authorization context to which this secret belongs.Retrieves a map of HTTP authorization headers to be used with this secret.abstract OwnergetOwner()Retrieves theOwnerassociated with this secret.abstract booleanChecks if the secret has expired.abstract booleanisValid()Checks if the secret is currently valid and usable for authorization.abstract intpriority()The priority of this secret.
-
Constructor Details
-
Secret
public Secret()
-
-
Method Details
-
priority
public abstract int priority()The priority of this secret. Higher priority secrets are preferred when we try to set multiple secret in SecretManagerProvider.- Returns:
- the priority as an integer.
-
getOwner
Retrieves theOwnerassociated with this secret. The owner represents the entity (user or application) that possesses and uses the secret.- Returns:
- The
Ownerof this secret.
-
getContext
Retrieves the authorization context to which this secret belongs. The context is typically a string representing a specific environment, service, or scope (e.g., a VO or a VRE).- Returns:
- The string representing the context.
-
getHTTPAuthorizationHeaders
Retrieves a map of HTTP authorization headers to be used with this secret. These headers can be directly added to an HTTP request for authentication.- Returns:
- A
Map<String, String>containing the header names and their corresponding values.
-
isValid
public abstract boolean isValid()Checks if the secret is currently valid and usable for authorization. A secret may be invalid if it has been revoked or has not yet become active.- Returns:
trueif the secret is valid,falseotherwise.
-
isExpired
public abstract boolean isExpired()Checks if the secret has expired. An expired secret should no longer be used for authorization.- Returns:
trueif the secret has expired,falseotherwise.
-