use of org.wso2.carbon.identity.secret.mgt.core.constant.SecretConstants.ErrorMessages.ERROR_CODE_SECRET_DOES_NOT_EXISTS in project carbon-identity-framework by wso2.
the class SecretManagerImpl method getSecret.
@Override
public Secret getSecret(String secretTypeName, String secretName) throws SecretManagementException {
validateSecretManagerEnabled();
validateSecretRetrieveRequest(secretTypeName, secretName);
SecretType secretType = getSecretType(secretTypeName);
Secret secret = this.getSecretDAO().getSecretByName(secretName, secretType, getTenantId());
if (secret == null) {
if (log.isDebugEnabled()) {
log.debug("No secret found for the secretName: " + secretName);
}
throw handleClientException(ERROR_CODE_SECRET_DOES_NOT_EXISTS, secretName, null);
}
if (log.isDebugEnabled()) {
log.debug("Secret: " + secretName + " is retrieved successfully.");
}
return secret;
}
use of org.wso2.carbon.identity.secret.mgt.core.constant.SecretConstants.ErrorMessages.ERROR_CODE_SECRET_DOES_NOT_EXISTS in project carbon-identity-framework by wso2.
the class SecretManagerImpl method deleteSecret.
@Override
public void deleteSecret(String secretTypeName, String secretName) throws SecretManagementException {
validateSecretManagerEnabled();
validateSecretDeleteRequest(secretTypeName, secretName);
SecretType secretType = getSecretType(secretTypeName);
if (isSecretExist(secretTypeName, secretName)) {
this.getSecretDAO().deleteSecretByName(secretName, secretType.getId(), getTenantId());
if (log.isDebugEnabled()) {
log.debug("Secret: " + secretName + " is deleted successfully.");
}
} else {
throw handleClientException(ERROR_CODE_SECRET_DOES_NOT_EXISTS, secretName);
}
}
Aggregations