Skip to content

Commit

Permalink
Update uploadServiceProvider in SAMLSSOServiceProviderDAOImpl.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Osara-B committed Dec 19, 2024
1 parent c67895f commit dc1635e
Showing 1 changed file with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,30 @@ public boolean isServiceProviderExists(String issuer) throws IdentityException {
public SAMLSSOServiceProviderDO uploadServiceProvider(SAMLSSOServiceProviderDO serviceProviderDO)
throws IdentityException {

addServiceProvider(serviceProviderDO);
return serviceProviderDO;
validateServiceProvider(serviceProviderDO);
if (serviceProviderDO.getDefaultAssertionConsumerUrl() == null) {
throw new IdentityException("No default assertion consumer URL provided for service provider :" +
serviceProviderDO.getIssuer());
}

try {
if (processIsServiceProviderExists(serviceProviderDO.getIssuer())) {
debugLog(serviceProviderInfo(serviceProviderDO) + " already exists.");
throw new IdentityException(serviceProviderInfo(serviceProviderDO) + " already exists.");
}
NamedJdbcTemplate namedJdbcTemplate = JdbcUtils.getNewNamedJdbcTemplate();
namedJdbcTemplate.withTransaction(template -> {
processAddServiceProvider(serviceProviderDO);
processAddSPProperties(serviceProviderDO);
return null;
});
debugLog(serviceProviderInfo(serviceProviderDO) + " is added successfully.");
return serviceProviderDO;
} catch (TransactionException | DataAccessException e) {
String msg = "Error while adding " + serviceProviderInfo(serviceProviderDO);
log.error(msg, e);
throw new IdentityException(msg, e);
}
}

private void debugLog(String message) {
Expand Down

0 comments on commit dc1635e

Please sign in to comment.