From 94f40efcce2dc533ff94673242f36c19fcf2a2d3 Mon Sep 17 00:00:00 2001
From: Guillaume Rousse <guillaume.rousse@renater.fr>
Date: Fri, 8 Dec 2017 14:07:41 +0100
Subject: [PATCH] keep all existing accounts when updating accounts file

---
 lib/IdPAccountManager/WebRequest.pm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/IdPAccountManager/WebRequest.pm b/lib/IdPAccountManager/WebRequest.pm
index 558562a..c828e80 100644
--- a/lib/IdPAccountManager/WebRequest.pm
+++ b/lib/IdPAccountManager/WebRequest.pm
@@ -11,6 +11,7 @@ use Log::Any::Adapter;
 use List::MoreUtils qw(uniq);
 
 use IdPAccountManager::TestAccount;
+use IdPAccountManager::TestAccount::Manager;
 use IdPAccountManager::AuthenticationToken;
 use IdPAccountManager::ServiceProvider;
 use IdPAccountManager::SAMLMetadata;
@@ -493,11 +494,15 @@ sub req_validate_token {
     }
 
     ## Update simpleSAMLphp configuration to enable test accounts
+    my $accounts = IdPAccountManager::TestAccount::Manager->get_testaccounts(
+        db => $self->{db}
+    );
+
     eval {
         IdPAccountManager::Tools::update_ssp_authsources(
             $self->{configuration}->{_}->{templates_dir},
             $self->{configuration}->{idp}->{accounts_file},
-            \@accounts,
+            $accounts
         );
     };
     if ($EVAL_ERROR) {
-- 
GitLab