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
FieldsModifier and TypeFieldDescriptionstatic final StringKey of tag to mark the domain (who uses it) of a Key handled by Azure Key Vault. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleandoesDomainMatch(KeyItem keyItem, String domain) Verifies if an Azure Key Vault key has the wanted domain (who use it).static booleandoesTypeMatch(KeyBundle keyBundle, List<String> expectedKtys) Verifies if a key has a given type.static booleandoOpsMatch(KeyBundle keyBundle, List<String> expectedOps) Verifies if a key is suitable for given operations.static StringgetKeyName(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 booleanVerifies if a key is expired.static booleanVerifies if a key:static booleanisValid(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-KeyItemdomain- The wanted domain.- Returns:
trueif 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:
trueif 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:
trueif the key is valid, otherwisefalse.- See Also:
-
doOpsMatch
Verifies if a key is suitable for given operations.
- Parameters:
keyBundle-KeyBundleexpectedOps-JsonWebKeyOperation- Returns:
trueif the key is suitable, otherwisefalse.
-
doesTypeMatch
Verifies if a key has a given type.
- Parameters:
keyBundle-KeyBundleexpectedKtys-JsonWebKeyType- Returns:
trueif 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:
trueif the key is expired, otherwisefalse.
-