diff --git a/bin/account-manager.pl.in b/bin/account-manager.pl.in index 4a063783261f5e1383a2290a3f840ef20be46049..92a6e2943e558f6914274a8589d4c22830230c3e 100755 --- a/bin/account-manager.pl.in +++ b/bin/account-manager.pl.in @@ -98,7 +98,7 @@ sub add_account { die "Failed to save test account\n" unless $test_account->save( - accounts_validity_period => $configuration->{_}->{accounts_validity_period} + accounts_validity_period => $configuration->{service}->{account_validity_period} ); printf "Account created:\n\tuserid: user%d\n\tpassword: %s\n", diff --git a/conf/manager.conf.in b/conf/manager.conf.in index 6f96ecc23308295f206b6e22ee30e96b9a39025f..d81efe0ed2a27773f4e9276b59e318f9402d936c 100644 --- a/conf/manager.conf.in +++ b/conf/manager.conf.in @@ -1,27 +1,16 @@ -# Validity period of test accounts, in days -accounts_validity_period = 7 - # Token validity period, in hours tokens_validity_period = 2 # Templates directory templates_dir = @templatesdir@ -# Development feature -# hard-coded list of contactPersons -# these email addresses will be added to the list of contacts for any SP -dev_sp_contact = john@my.fqdn, sarah@my.fqdn - # From field use by the account manager notice_from = edugain-access-check.fqdn # federation metadata local copy path federation_metadata_file = @sysconfdir@/edugain-md.xml -# Valid account profiles -account_profiles = fullset1, limitedset1, generic1, student1, student2, teacher1, teacher2, alumni1, librarywalkin1, employee1, researcher1 - # Path to sendmail executable sendmail_path = /usr/sbin/sendmail @@ -47,3 +36,11 @@ scope = my.fqdn entityid = https://my.fqdn/simplesaml/saml2/idp/metadata.php displayname = eduGAIN Access Check accounts_file = @sysconfdir@/accounts.php + +[service] +# validity period of test accounts, in days +account_validity_period = 7 +# valid account profiles +account_profiles = fullset1, limitedset1, generic1, student1, student2, teacher1, teacher2, alumni1, librarywalkin1, employee1, researcher1 +# override contacts defined in metadata if defined +contacts = john@my.fqdn, sarah@my.fqdn diff --git a/lib/IdPAccountManager/WebRequest.pm b/lib/IdPAccountManager/WebRequest.pm index 502495d4b23f8217b274999b13e5ae3637b0bd69..e10acc64058fb7c21ce27ebfa47e5832595f2c5b 100644 --- a/lib/IdPAccountManager/WebRequest.pm +++ b/lib/IdPAccountManager/WebRequest.pm @@ -126,7 +126,7 @@ sub execute { SCRIPT_NAME => $ENV{SCRIPT_NAME} }, conf => { - accounts_validity_period => $self->{configuration}->{accounts_validity_period}, + accounts_validity_period => $self->{configuration}->{service}->{account_validity_period}, app_name => $self->{configuration}->{app}->{name}, app_url => $self->{configuration}->{app}->{url}, idp_scope => $self->{configuration}->{idp}->{scope}, @@ -258,10 +258,10 @@ sub req_select_sp { } } - if ($self->{configuration}->{_}->{dev_sp_contact}) { + if ($self->{configuration}->{service}->{contacts}) { # replace SP contacts $provider->contacts( - split(/, */, $self->{configuration}->{_}->{dev_sp_contact}) + split(/, */, $self->{configuration}->{service}->{contacts}) ); } @@ -299,10 +299,10 @@ sub req_generate_token { return; } - if ($self->{configuration}->{_}->{dev_sp_contact}) { + if ($self->{configuration}->{service}->{contacts}) { # replace SP contacts $provider->contacts( - split(/, */, $self->{configuration}->{_}->{dev_sp_contact}) + split(/, */, $self->{configuration}->{service}->{contacts}) ); } @@ -464,7 +464,7 @@ sub req_validate_token { ## create test accounts my @accounts; - foreach my $profile (split(/, */, $self->{configuration}->{_}->{account_profiles})) { + foreach my $profile (split(/, */, $self->{configuration}->{service}->{account_profiles})) { my $account = IdPAccountManager::TestAccount->new( db => $self->{db}, profile => $profile, @@ -473,7 +473,7 @@ sub req_validate_token { ); next unless $account; next unless $account->save( - accounts_validity_period => $self->{configuration}->{_}->{accounts_validity_period} + accounts_validity_period => $self->{configuration}->{service}->{account_validity_period} ); push @accounts, $account; }