use of org.wso2.carbon.identity.secret.mgt.core.constant.SecretConstants.ErrorMessages.ERROR_CODE_SECRETS_DOES_NOT_EXISTS in project carbon-identity-framework by wso2.
the class SecretManagerImpl method getSecrets.
@Override
public Secrets getSecrets(String secretTypeName) throws SecretManagementException {
validateSecretManagerEnabled();
validateSecretsRetrieveRequest(secretTypeName);
SecretType secretType = getSecretType(secretTypeName);
List secretList = this.getSecretDAO().getSecrets(secretType, getTenantId());
if (secretList == null) {
if (log.isDebugEnabled()) {
log.debug("No secret found for the secretTypeName: " + secretTypeName + "for the tenant: " + getTenantDomain());
}
throw handleClientException(ERROR_CODE_SECRETS_DOES_NOT_EXISTS, null);
}
if (log.isDebugEnabled()) {
log.debug("All secrets of tenant: " + getTenantDomain() + " are retrieved successfully.");
}
return new Secrets(secretList);
}
use of org.wso2.carbon.identity.secret.mgt.core.constant.SecretConstants.ErrorMessages.ERROR_CODE_SECRETS_DOES_NOT_EXISTS in project carbon-identity-framework by wso2.
the class SecretDAOImpl method getSecrets.
@Override
public List getSecrets(SecretType secretType, int tenantId) throws SecretManagementException {
NamedJdbcTemplate jdbcTemplate = getNewTemplate();
try {
return jdbcTemplate.executeQuery(GET_SECRETS, (LambdaExceptionUtils.rethrowRowMapper((resultSet, rowNumber) -> {
String secretId = resultSet.getString(DB_SCHEMA_COLUMN_NAME_ID);
String secretName = resultSet.getString(DB_SCHEMA_COLUMN_NAME_SECRET_NAME);
String secretLastModified = resultSet.getString(DB_SCHEMA_COLUMN_NAME_LAST_MODIFIED);
String secretCreatedTime = resultSet.getString(DB_SCHEMA_COLUMN_NAME_CREATED_TIME);
String description = resultSet.getString(DB_SCHEMA_COLUMN_NAME_DESCRIPTION);
Secret secret = new Secret();
secret.setCreatedTime(secretCreatedTime);
secret.setSecretId(secretId);
secret.setSecretName(secretName);
secret.setLastModified(secretLastModified);
secret.setTenantDomain(IdentityTenantUtil.getTenantDomain(tenantId));
secret.setSecretType(secretType.getName());
secret.setDescription(description);
return secret;
})), preparedStatement -> {
preparedStatement.setString(DB_SCHEMA_COLUMN_NAME_TYPE, secretType.getId());
preparedStatement.setInt(DB_SCHEMA_COLUMN_NAME_TENANT_ID, tenantId);
});
} catch (DataAccessException e) {
throw handleServerException(ERROR_CODE_SECRETS_DOES_NOT_EXISTS, e);
}
}
Aggregations