Skip to content

Commit

Permalink
Introduce JDBC based persistence for SAML
Browse files Browse the repository at this point in the history
  • Loading branch information
Osara-B committed Jan 2, 2025
1 parent 7c68916 commit 9cffcfa
Show file tree
Hide file tree
Showing 26 changed files with 2,175 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@
*/
public class SAMLSSOServiceProviderManager {

SAMLServiceProviderPersistenceManagerFactory
samlSSOPersistenceManagerFactory = new SAMLServiceProviderPersistenceManagerFactory();
SAMLSSOServiceProviderDAO serviceProviderDAO = samlSSOPersistenceManagerFactory.getSAMLServiceProviderPersistenceManager();
SAMLServiceProviderPersistenceManagerFactory samlSSOPersistenceManagerFactory =
new SAMLServiceProviderPersistenceManagerFactory();
SAMLSSOServiceProviderDAO serviceProviderDAO =
samlSSOPersistenceManagerFactory.getSAMLServiceProviderPersistenceManager();

/**
* Add a saml service provider.
*
* @param serviceProviderDO Service provider information object.
* @param tenantId Tenant ID.
* @param serviceProviderDO Service provider information object.
* @param tenantId Tenant ID.
* @return True if success.
* @throws IdentityException Error when adding the SAML service provider.
*/
Expand All @@ -50,9 +51,9 @@ public boolean addServiceProvider(SAMLSSOServiceProviderDO serviceProviderDO, in
/**
* Update a saml service provider if already exists.
*
* @param serviceProviderDO Service provider information object.
* @param currentIssuer Issuer of the service provider before the update.
* @param tenantId Tenant ID.
* @param serviceProviderDO Service provider information object.
* @param currentIssuer Issuer of the service provider before the update.
* @param tenantId Tenant ID.
* @return True if success.
* @throws IdentityException Error when updating the SAML service provider.
*/
Expand All @@ -65,7 +66,7 @@ public boolean updateServiceProvider(SAMLSSOServiceProviderDO serviceProviderDO,
/**
* Get all the saml service providers.
*
* @param tenantId Tenant ID.
* @param tenantId Tenant ID.
* @return Array of SAMLSSOServiceProviderDO.
* @throws IdentityException Error when getting the SAML service providers.
*/
Expand All @@ -77,8 +78,8 @@ public SAMLSSOServiceProviderDO[] getServiceProviders(int tenantId) throws Ident
/**
* Get SAML issuer properties from service provider by saml issuer name.
*
* @param issuer SAML issuer name.
* @param tenantId Tenant ID.
* @param issuer SAML issuer name.
* @param tenantId Tenant ID.
* @return SAMLSSOServiceProviderDO
* @throws IdentityException Error when getting the SAML service provider.
*/
Expand All @@ -90,22 +91,21 @@ public SAMLSSOServiceProviderDO getServiceProvider(String issuer, int tenantId)
/**
* Check whether SAML issuer exists by saml issuer name.
*
* @param issuer SAML issuer name.
* @param tenantId Tenant ID.
* @param issuer SAML issuer name.
* @param tenantId Tenant ID.
* @return True if exists
* @throws IdentityException Error when checking the SAML service provider.
*/
public boolean isServiceProviderExists(String issuer, int tenantId)
throws IdentityException {
public boolean isServiceProviderExists(String issuer, int tenantId) throws IdentityException {

return serviceProviderDAO.isServiceProviderExists(issuer, tenantId);
}

/**
* Removes the SAML configuration related to the application, idenfied by the issuer.
*
* @param issuer Issuer of the SAML application.
* @param tenantId Tenant ID.
* @param issuer Issuer of the SAML application.
* @param tenantId Tenant ID.
* @throws IdentityException Error when removing the SAML configuration.
*/
public boolean removeServiceProvider(String issuer, int tenantId) throws IdentityException {
Expand All @@ -116,8 +116,8 @@ public boolean removeServiceProvider(String issuer, int tenantId) throws Identit
/**
* Upload the SAML configuration related to the application, using metadata.
*
* @param samlssoServiceProviderDO SAML service provider information object.
* @param tenantId Tenant ID.
* @param samlssoServiceProviderDO SAML service provider information object.
* @param tenantId Tenant ID.
* @return SAML service provider information object.
* @throws IdentityException Error when uploading the SAML configuration.
*/
Expand Down
Loading

0 comments on commit 9cffcfa

Please sign in to comment.