« blib/lib/Lemonldap/NG/Portal/Lib/CustomModule.pm
↑ Summary
blib/lib/Lemonldap/NG/Portal/Issuer/JitsiMeetTokens.pm »
| 1 | package Lemonldap::NG::Portal::Plugins::ForceAuthn; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use Mouse; | ||
| 5 | use Lemonldap::NG::Portal::Main::Constants qw( | ||
| 6 | PE_OK | ||
| 7 | PE_MUSTAUTHN | ||
| 8 | ); | ||
| 9 | |||
| 10 | our $VERSION = '2.22.0'; | ||
| 11 | |||
| 12 | extends 'Lemonldap::NG::Portal::Main::Plugin'; | ||
| 13 | |||
| 14 | # INITIALIZATION | ||
| 15 | |||
| 16 | use constant forAuthUser => 'run'; | ||
| 17 | |||
| 18 | # RUNNING METHOD | ||
| 19 | |||
| 20 | sub run { | ||
| 21 | my ( $self, $req ) = @_; | ||
| 22 | if ( $req->env->{HTTP_HOST} | ||
| 23 | and $req->portal =~ /\Q$req->{env}->{HTTP_HOST}/ ) | ||
| 24 | { | ||
| 25 | my $delta = time - $req->{sessionInfo}->{_lastAuthnUTime}; | ||
| 26 | $self->logger->debug( "Delta with last Authn -> " . $delta ); | ||
| 27 | |||
| 28 | return $delta <= $self->conf->{portalForceAuthnInterval} | ||
| 29 | ? PE_OK | ||
| 30 | : PE_MUSTAUTHN; | ||
| 31 | } | ||
| 32 | } | ||
| 33 | |||
| 34 | 1; |