File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
src/main/java/io/supertokens/storage/postgresql Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -4538,4 +4538,13 @@ public void removeExpiredSAMLCodesAndRelayStates() throws StorageQueryException
45384538 throw new StorageQueryException (e );
45394539 }
45404540 }
4541+
4542+ @ Override
4543+ public int countSAMLClients (TenantIdentifier tenantIdentifier ) throws StorageQueryException {
4544+ try {
4545+ return SAMLQueries .countSAMLClients (this , tenantIdentifier );
4546+ } catch (SQLException e ) {
4547+ throw new StorageQueryException (e );
4548+ }
4549+ }
45414550}
Original file line number Diff line number Diff line change @@ -407,4 +407,18 @@ public static void removeExpiredSAMLCodesAndRelayStates(Start start) throws Stor
407407 pst .setLong (1 , expiredBefore );
408408 });
409409 }
410+
411+ public static int countSAMLClients (Start start , TenantIdentifier tenantIdentifier ) throws StorageQueryException , SQLException {
412+ String QUERY = "SELECT COUNT(*) as c FROM " + getConfig (start ).getSAMLClientsTable ()
413+ + " WHERE app_id = ? AND tenant_id = ?" ;
414+ return execute (start , QUERY , pst -> {
415+ pst .setString (1 , tenantIdentifier .getAppId ());
416+ pst .setString (2 , tenantIdentifier .getTenantId ());
417+ }, result -> {
418+ if (result .next ()) {
419+ return result .getInt ("c" );
420+ }
421+ return 0 ;
422+ });
423+ }
410424}
You can’t perform that action at this time.
0 commit comments