-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmetadata-ttl.patch
31 lines (29 loc) · 1.17 KB
/
metadata-ttl.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
--- a/usr/share/perl5/Lemonldap/NG/Portal/Issuer/OpenIDConnect.pm
+++ b/usr/share/perl5/Lemonldap/NG/Portal/Issuer/OpenIDConnect.pm
@@ -2704,8 +2704,13 @@ sub logout {
sub metadata {
my ( $self, $req ) = @_;
$req->data->{dropCsp} = 1 if $self->conf->{oidcDropCspHeaders};
+ my %args;
+ if ( $self->conf->{oidcServiceMetadataTtl} ) {
+ $args{ttl} = $self->conf->{oidcServiceMetadataTtl};
+ $args{date} = $self->conf->{cfgDate};
+ }
return $self->p->sendJSONresponse( $req,
- $self->metadataDoc( $self->get_issuer($req) ) );
+ $self->metadataDoc( $self->get_issuer($req) ), %args );
}
# Store request parameters in %ENV
--- a/usr/share/perl5/Lemonldap/NG/Portal/Main/Run.pm
+++ b/usr/share/perl5/Lemonldap/NG/Portal/Main/Run.pm
@@ -1444,6 +1444,10 @@ sub sendJSONresponse {
# Handle caching
if ( $args{ttl} and $args{ttl} =~ /^\d+$/ ) {
push @{ $res->[1] }, 'Cache-Control' => 'public, max-age=' . $args{ttl};
+ push @{ $res->[1] },
+ 'Last-Modified' =>
+ POSIX::strftime( "%a, %0e %b %Y %H:%M:%S GMT", gmtime($args{date}) )
+ if $args{date};
}
else {
push @{ $res->[1] },