« blib/lib/Lemonldap/NG/Portal/Lib/SOAPProxy.pm
↑ Summary
blib/lib/Lemonldap/NG/Portal/2F/Register/Base.pm »
| 1 | package Lemonldap::NG::Portal::Plugins::AdminLogout; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use Mouse; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 1 | extends 'Lemonldap::NG::Portal::Lib::OIDCPlugin'; | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | our $VERSION = '2.23.4'; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | ▶ | sub init { | ||||||||||||||||||||||||||
|
Subroutine
init: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 11 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 1 | ▶ | return unless $self->SUPER::init; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 1 | $self->addUnauthRoute( admintokenrevoke => 'adminTokenRevoke', ['POST'] ); | |||||||||||||||||||||||||||
| 16 | 1 | 1; | |||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 0 | ▶ | sub adminTokenRevoke { | ||||||||||||||||||||||||||
|
Subroutine
adminTokenRevoke: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 20 | 0 | my ( $self, $req ) = @_; | |||||||||||||||||||||||||||
| 21 | 0 | my $auth = $req->env->{HTTP_AUTHORIZATION}; | |||||||||||||||||||||||||||
| 22 | 0 | ▶ | unless ($auth | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$auth and $auth eq 'Bearer ' . $self->conf->{"adminLogoutServerSecret"}
MC/DC0%0/2
$auth and $auth eq 'Bearer ' . $self->conf->{"adminLogoutServerSecret"}
$auth
$auth eq 'Bearer ' . $self->conf->{"adminLogoutServerSecret"}
Truth table0%0/3
A and B
A= $authB= $auth eq 'Bearer ' . $self->conf->{"adminLogoutServerSecret"}
| |||||||||||||||||||||||||||||
| 23 | and $auth eq "Bearer " . $self->conf->{adminLogoutServerSecret} ) | ||||||||||||||||||||||||||||
| 24 | { | ||||||||||||||||||||||||||||
| 25 | 0 | return $self->p->sendError( $req, 'Bad credentials', 401 ); | |||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 0 | my $type = $req->param('token_hint'); | |||||||||||||||||||||||||||
| 29 | 0 | ▶ | if ( $type eq 'SSO' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 30 | 0 | return $self->ssoLogout($req); | |||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 0 | ▶ | if ( $type =~ /^(?:refresh|access)_token$/ ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 34 | return $self->oidc->_revokeToken( | ||||||||||||||||||||||||||||
| 35 | $req, | ||||||||||||||||||||||||||||
| 36 | 0 | ▶ | sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 37 | 0 | my ($session) = @_; | |||||||||||||||||||||||||||
| 38 | return ( | ||||||||||||||||||||||||||||
| 39 | $self->oidc->getRP( $session->data->{client_id} ), | ||||||||||||||||||||||||||||
| 40 | $session->data->{ $self->conf->{whatToTrace} } | ||||||||||||||||||||||||||||
| 41 | 0 | ); | |||||||||||||||||||||||||||
| 42 | }, | ||||||||||||||||||||||||||||
| 43 | 0 | 'OIDCTokenRevokeServer', | |||||||||||||||||||||||||||
| 44 | $req->param('raw'), | ||||||||||||||||||||||||||||
| 45 | ); | ||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 0 | return $self->sendError( $req, "Unknown token_hint '$type'", 400 ); | |||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 0 | ▶ | sub ssoLogout { | ||||||||||||||||||||||||||
|
Subroutine
ssoLogout: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 52 | 0 | my ( $self, $req ) = @_; | |||||||||||||||||||||||||||
| 53 | 0 | ▶ | my $id = $req->param('token') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | or return $self->sendError( $req, 'Missing token', 400 ); | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | # Like for tokens, the caller may give a storage identifier instead of a | ||||||||||||||||||||||||||||
| 57 | # session one. This is what the Manager does, since it collects sessions | ||||||||||||||||||||||||||||
| 58 | # using searchOn() | ||||||||||||||||||||||||||||
| 59 | 0 | my $raw = $req->param('raw'); | |||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 0 | ▶ | my $session = | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 62 | $self->p->getApacheSession( $id, ( $raw ? ( hashStore => 0 ) : () ) ); | ||||||||||||||||||||||||||||
| 63 | 0 | ▶ | unless ($session) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 64 | 0 | return $self->sendError( $req, "Session $id not found", 400 ); | |||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 0 | $req->userData( $req->sessionInfo( $session->data ) ); | |||||||||||||||||||||||||||
| 68 | return $self->p->do( | ||||||||||||||||||||||||||||
| 69 | $req, | ||||||||||||||||||||||||||||
| 70 | [ | ||||||||||||||||||||||||||||
| 71 | 0 | ▶ | @{ $self->p->beforeLogout }, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 72 | 'authLogout', | ||||||||||||||||||||||||||||
| 73 | ( $raw ? [ 'deleteSession', rawSessionId => 1 ] : 'deleteSession' ), | ||||||||||||||||||||||||||||
| 74 | ] | ||||||||||||||||||||||||||||
| 75 | ); | ||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 1 | 1; | |||||||||||||||||||||||||||