From 61dc9a9f771b431277de12b16803b0a2da5ebe9b Mon Sep 17 00:00:00 2001
From: Guillaume Rousse <guillaume.rousse@renater.fr>
Date: Fri, 2 Mar 2018 16:00:11 +0100
Subject: [PATCH] move tokens_validity_period in service section

---
 bin/access-check-manager.pl.in | 2 +-
 conf/manager.conf.in           | 8 +++-----
 lib/AccountManager/App.pm      | 2 +-
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/bin/access-check-manager.pl.in b/bin/access-check-manager.pl.in
index bfd840a..c045493 100755
--- a/bin/access-check-manager.pl.in
+++ b/bin/access-check-manager.pl.in
@@ -320,7 +320,7 @@ sub add_token {
     }
 
     # compute a new token
-    my $validity_period = $configuration->{_}->{tokens_validity_period};
+    my $validity_period = $configuration->{service}->{tokens_validity_period};
     my $token = AccountManager::Token->new(
         db              => $db,
         email_address   => $options{email_address},
diff --git a/conf/manager.conf.in b/conf/manager.conf.in
index 2a74e31..ebe24fd 100644
--- a/conf/manager.conf.in
+++ b/conf/manager.conf.in
@@ -1,7 +1,3 @@
-
-# Token validity period, in hours
-tokens_validity_period = 2
-
 [app]
 support_email = support@my.fqdn
 
@@ -35,8 +31,10 @@ displayname = eduGAIN Access Check
 
 # default parameters for all services
 [service]
-# validity period of test accounts, in days
+# test accounts validity period, in days
 account_validity_period = 7
+# token validity period, in hours
+tokens_validity_period = 2
 # valid account profiles
 account_profiles = fullset1, limitedset1, generic1, student1, student2, teacher1, teacher2, alumni1, librarywalkin1, employee1, researcher1
 # override contacts defined in metadata if defined
diff --git a/lib/AccountManager/App.pm b/lib/AccountManager/App.pm
index 307e26e..1a8bbc4 100644
--- a/lib/AccountManager/App.pm
+++ b/lib/AccountManager/App.pm
@@ -398,7 +398,7 @@ sub req_complete_challenge {
 
     # compute a new token
     my $validity_period =
-        $self->{configuration}->{_}->{tokens_validity_period};
+        $self->{configuration}->{service}->{tokens_validity_period};
     my $token = AccountManager::Token->new(
         db              => $self->{db},
         email_address   => $self->{in}->{email},
-- 
GitLab