use of com.aws.greengrass.security.exceptions.ServiceProviderConflictException in project aws-greengrass-nucleus by aws-greengrass.
the class SecurityService method registerCryptoKeyProvider.
/**
* Register crypto key provider for the key type.
*
* @param keyProvider Crypto key provider
* @throws ServiceProviderConflictException if key type is already registered
*/
public void registerCryptoKeyProvider(CryptoKeySpi keyProvider) throws ServiceProviderConflictException {
CaseInsensitiveString keyType = new CaseInsensitiveString(keyProvider.supportedKeyType());
logger.atInfo().kv(KEY_TYPE, keyType).log("Register crypto key service provider");
CryptoKeySpi provider = cryptoKeyProviderMap.computeIfAbsent(keyType, k -> keyProvider);
if (!provider.equals(keyProvider)) {
throw new ServiceProviderConflictException(String.format("Key type %s crypto key provider is registered", keyType));
}
}
use of com.aws.greengrass.security.exceptions.ServiceProviderConflictException in project aws-greengrass-nucleus by aws-greengrass.
the class SecurityService method registerMqttConnectionProvider.
/**
* Register mqtt connection provider for the key type.
*
* @param mqttProvider Mqtt connection provider
* @throws ServiceProviderConflictException if key type is already registered
*/
public void registerMqttConnectionProvider(MqttConnectionSpi mqttProvider) throws ServiceProviderConflictException {
CaseInsensitiveString keyType = new CaseInsensitiveString(mqttProvider.supportedKeyType());
logger.atInfo().kv(KEY_TYPE, keyType).log("Register crypto key service provider");
MqttConnectionSpi provider = mqttConnectionProviderMap.computeIfAbsent(keyType, k -> mqttProvider);
if (!provider.equals(mqttProvider)) {
throw new ServiceProviderConflictException(String.format("Key type %s mqtt connection provider is " + "registered", keyType));
}
}
Aggregations