Class KeyUtils
java.lang.Object
it.pagopa.swclient.mil.azureservices.keyvault.keys.util.KeyUtils
Provides utilities to handle keys in different formats.
- Author:
- Antonio Tarricone
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Key of tag to mark the domain (who uses it) of a Key handled by Azure Key Vault. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
doesDomainMatch
(KeyItem keyItem, String domain) Verifies if an Azure Key Vault key has the wanted domain (who use it).static boolean
doesTypeMatch
(KeyBundle keyBundle, List<String> expectedKtys) Verifies if a key has a given type.static boolean
doOpsMatch
(KeyBundle keyBundle, List<String> expectedOps) Verifies if a key is suitable for given operations.static String
getKeyName
(KeyItem keyItem) Returns the name of an Azure Key Vault key.static String[]
getKeyNameVersion
(KeyItem keyItem) Returns the name and the version of an Azure Key Vault key.getQueryParameters
(String url) Extracts query parameters from link to handle paged results from Azure Key Vault.static boolean
Verifies if a key is expired.static boolean
Verifies if a key:static boolean
isValid
(String kid, KeyAttributes keyAttributes) Verifies if a key:
-
Field Details
-
DOMAIN_KEY
Key of tag to mark the domain (who uses it) of a Key handled by Azure Key Vault.
- See Also:
-
-
Constructor Details
-
KeyUtils
private KeyUtils()This class has static methods only.
-
-
Method Details
-
getKeyName
Returns the name of an Azure Key Vault key.
- Parameters:
keyItem
-KeyItem
- Returns:
- The name of the key.
-
getKeyNameVersion
Returns the name and the version of an Azure Key Vault key.
- Parameters:
keyItem
-KeyItem
- Returns:
- An array which contains in first position the name of the key and in second the version.
-
doesDomainMatch
Verifies if an Azure Key Vault key has the wanted domain (who use it).
- Parameters:
keyItem
-KeyItem
domain
- The wanted domain.- Returns:
true
if the domain matches, otherwisefalse
.
-
isValid
Verifies if a key:
- is enabled;
- is not expired;
- has coherent creation date;
- has coherent not-before-date.
- Parameters:
kid
- The ID of the key.keyAttributes
-KeyAttributes
- Returns:
true
if the key is valid, otherwisefalse
.
-
isValid
Verifies if a key:
- is enabled;
- is not expired;
- has coherent creation date;
- has coherent not-before-date.
- Parameters:
keyItem
-KeyItem
- Returns:
true
if the key is valid, otherwisefalse
.- See Also:
-
doOpsMatch
Verifies if a key is suitable for given operations.
- Parameters:
keyBundle
-KeyBundle
expectedOps
-JsonWebKeyOperation
- Returns:
true
if the key is suitable, otherwisefalse
.
-
doesTypeMatch
Verifies if a key has a given type.
- Parameters:
keyBundle
-KeyBundle
expectedKtys
-JsonWebKeyType
- Returns:
true
if the key has the given type, otherwisefalse
.
-
getQueryParameters
Extracts query parameters from link to handle paged results from Azure Key Vault.
- Parameters:
url
- The URL to be process.- Returns:
- The query parameters.
-
isExpired
Verifies if a key is expired.
- Parameters:
keyItem
-KeyItem
- Returns:
true
if the key is expired, otherwisefalse
.
-