Package org.opencms.util
Class CmsSecretUtil
java.lang.Object
org.opencms.util.CmsSecretUtil
Utility methods for fetching secrets from the secret provider.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringGets the secret for the exact given key.static StringgetSecretForUri(String prefix, CmsObject cms) Looks up a path dependent secret in the secret store for the current URI.static StringgetSecretForUri(String prefix, CmsObject cms, String rootPath) Looks up a path dependent secret in the secret store for the given root path.
-
Constructor Details
-
CmsSecretUtil
public CmsSecretUtil()
-
-
Method Details
-
getSecret
Gets the secret for the exact given key.If no secret is found, null will be returned.
- Parameters:
key- the key for a secret- Returns:
- the secret
-
getSecretForUri
Looks up a path dependent secret in the secret store for the current URI.This is done as follows:
For the root path of each subsitemap we are in, in ascending order, the key (prefix + "." + path) is looked up. The first match will be returned. As a special case, the key for the site root is always looked up, even if it's not configured as a sitemap.
- Parameters:
prefix- the key prefixcms- the OpenCms user context to use when resolving the secret- Returns:
- the secret (or null, if nothing was found)
-
getSecretForUri
Looks up a path dependent secret in the secret store for the given root path.This is done as follows:
For the root path of each subsitemap we are in, in ascending order, the key (prefix + "." + path) is looked up. The first match will be returned. As a special case, the key for the site root is always looked up, even if it's not configured as a sitemap.
- Parameters:
prefix- the key prefixcms- the OpenCms user context to use when resolving the secretrootPath- the root path for which the secret should be looked up- Returns:
- the secret (or null, if nothing was found)
-