use of org.openkilda.saml.model.SamlConfig in project open-kilda by telstra.
the class SamlService method getById.
/**
* Gets the provider detail.
* @param uuid the uuid of provider.
* @return the SamlConfig
*/
@Transactional
public SamlConfig getById(String uuid) {
SamlConfigEntity samlConfigEntity = samlValidator.getEntityByUuid(uuid);
SamlConfig samlConfig = SamlConversionUtil.toSamlConfig(samlConfigEntity);
Blob blob = samlConfigEntity.getMetadata();
byte[] bdata;
if (blob != null) {
try {
bdata = blob.getBytes(1, (int) blob.length());
String metadata = new String(bdata);
samlConfig.setMetadata(metadata);
} catch (Exception e) {
LOGGER.error("Error occurred while getting provider detail" + e);
}
}
return samlConfig;
}
use of org.openkilda.saml.model.SamlConfig in project open-kilda by telstra.
the class DbMetadataProvider method fetchMetadata.
// This example code simply does straight JDBC
@Override
protected byte[] fetchMetadata() throws MetadataProviderException {
try {
SamlService samlService = ApplicationContextProvider.getContext().getBean(SamlService.class);
SamlConfig samlConfig = samlService.getById(getMetaDataEntityId());
byte[] bytes = null;
if (samlConfig.getMetadata() != null) {
String metadata = samlConfig.getMetadata();
bytes = metadata.getBytes();
}
return bytes;
} catch (Exception e) {
String errorMessage = "Unable to query metadata from database with entityId = " + getMetaDataEntityId();
throw new MetadataProviderException(errorMessage, e);
}
}
Aggregations