use of org.wso2.carbon.identity.secret.mgt.core.constant.SecretConstants.ErrorMessages.ERROR_CODE_UPDATE_SECRET in project carbon-identity-framework by wso2.
the class SecretManagerImpl method updateSecretValue.
@Override
public Secret updateSecretValue(String secretTypeName, String name, String value) throws SecretManagementException {
validateSecretManagerEnabled();
Secret secret, updatedSecret;
secret = getSecret(secretTypeName, name);
try {
updatedSecret = this.getSecretDAO().updateSecretValue(secret, encrypt(value));
} catch (CryptoException e) {
throw handleServerException(ERROR_CODE_UPDATE_SECRET, value, e);
}
if (log.isDebugEnabled()) {
log.debug(secret.getSecretName() + " secret value updated successfully.");
}
return updatedSecret;
}
use of org.wso2.carbon.identity.secret.mgt.core.constant.SecretConstants.ErrorMessages.ERROR_CODE_UPDATE_SECRET in project carbon-identity-framework by wso2.
the class SecretDAOImpl method updateSecretValue.
@Override
public Secret updateSecretValue(Secret secret, String value) throws SecretManagementException {
Timestamp currentTime = new java.sql.Timestamp(new Date().getTime());
NamedJdbcTemplate jdbcTemplate = getNewTemplate();
try {
jdbcTemplate.executeUpdate(UPDATE_SECRET_VALUE, preparedStatement -> {
preparedStatement.setString(DB_SCHEMA_COLUMN_NAME_ID, secret.getSecretId());
preparedStatement.setString(DB_SCHEMA_COLUMN_NAME_SECRET_VALUE, value);
preparedStatement.setTimeStamp(DB_SCHEMA_COLUMN_NAME_LAST_MODIFIED, currentTime, calendar);
});
secret.setLastModified(currentTime.toInstant().toString());
secret.setSecretValue(value);
} catch (DataAccessException e) {
throw handleServerException(ERROR_CODE_UPDATE_SECRET, "value", e);
}
return secret;
}
use of org.wso2.carbon.identity.secret.mgt.core.constant.SecretConstants.ErrorMessages.ERROR_CODE_UPDATE_SECRET in project carbon-identity-framework by wso2.
the class SecretDAOImpl method updateSecretDescription.
@Override
public Secret updateSecretDescription(Secret secret, String description) throws SecretManagementException {
Timestamp currentTime = new java.sql.Timestamp(new Date().getTime());
NamedJdbcTemplate jdbcTemplate = getNewTemplate();
try {
jdbcTemplate.executeUpdate(UPDATE_SECRET_DESCRIPTION, preparedStatement -> {
preparedStatement.setString(DB_SCHEMA_COLUMN_NAME_ID, secret.getSecretId());
preparedStatement.setString(DB_SCHEMA_COLUMN_NAME_DESCRIPTION, description);
preparedStatement.setTimeStamp(DB_SCHEMA_COLUMN_NAME_LAST_MODIFIED, currentTime, calendar);
});
secret.setLastModified(currentTime.toInstant().toString());
secret.setDescription(description);
} catch (DataAccessException e) {
throw handleServerException(ERROR_CODE_UPDATE_SECRET, "description", e);
}
return secret;
}
Aggregations