Modify ServiceToken TTL option (#1773)

This commit is contained in:
Christophe Maudoux 2019-05-27 23:07:18 +02:00
parent dece7d8aa0
commit 455221781f
5 changed files with 9 additions and 6 deletions

View File

@ -19,7 +19,7 @@ sub fetchId {
my ( $t, $_session_id, @vhosts ) = split /:/, $s;
# $_session_id and at least one vhost
unless (@vhosts and $_session_id) {
unless ( @vhosts and $_session_id ) {
$class->userLogger->error('Bad service token');
return 0;
}
@ -34,7 +34,10 @@ sub fetchId {
# Is token in good interval ?
my $localConfig = $class->localConfig;
my $ttl = $localConfig->{vhostOptions}->{$vh}->{vhostServiceTokenTTL} || $class->tsv->{handlerServiceTokenTTL};
my $ttl =
$localConfig->{vhostOptions}->{$vh}->{vhostServiceTokenTTL} <= 0
? $class->tsv->{handlerServiceTokenTTL}
: $localConfig->{vhostOptions}->{$vh}->{vhostServiceTokenTTL};
unless ( $t <= time and $t > time - $ttl ) {
$class->userLogger->warn('Expired service token');
return 0;

View File

@ -3558,7 +3558,7 @@ qr/^(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-
'type' => 'int'
},
'vhostServiceTokenTTL' => {
'default' => 30,
'default' => -1,
'type' => 'int'
},
'vhostType' => {

View File

@ -1698,7 +1698,7 @@ sub attributes {
},
vhostServiceTokenTTL => {
type => 'int',
default => 30,
default => -1,
},
vhostAliases => { type => 'text', },
vhostType => {

View File

@ -1205,7 +1205,7 @@ function templates(tpl,key) {
"type" : "int"
},
{
"default" : 30,
"default" : -1,
"get" : tpl+"s/"+key+"/"+"vhostServiceTokenTTL",
"id" : tpl+"s/"+key+"/"+"vhostServiceTokenTTL",
"title" : "vhostServiceTokenTTL",

File diff suppressed because one or more lines are too long