Fix error & not found VH (#1664)

This commit is contained in:
Christophe Maudoux 2019-03-04 20:53:39 +01:00
parent 7ead696ec0
commit c7ddae854c
13 changed files with 96 additions and 51 deletions

View File

@ -89,6 +89,7 @@ sub check {
if ( $req->error ) {
$msg = 'PE' . $req->{error};
$array_attrs = [ [], [], [] ];
$attrs = {};
}
else {
$msg = 'checkUser';
@ -123,15 +124,27 @@ sub check {
$auth = $self->_authorization( $req, $url );
$self->logger->debug(
"checkUser requested for user: $req->{user} and URL: $url");
$auth = $auth ? "allowed" : "forbidden";
$self->userLogger->notice( "checkUser -> $req->{user} is "
. uc($auth)
. " to access: $url" );
if ( $auth >= 0 ) {
# Return VirtualHost headers
$array_hdrs = $self->_headers( $req, $url );
$auth = $auth ? "allowed" : "forbidden";
$self->userLogger->notice( "checkUser -> $req->{user} is "
. uc($auth)
. " to access: $url" );
# Return VirtualHost headers
$array_hdrs = $self->_headers( $req, $url );
}
else {
$auth = 'VHnotFound';
$self->userLogger->notice(
"checkUser -> URL: $url has no configuration");
}
}
my $alert_auth = 'alert-warning';
if ( $auth eq 'allowed' ) { $alert_auth = 'alert-success' }
elsif ( $auth eq 'forbidden' ) { $alert_auth = 'alert-danger' }
# Display form
return $self->p->sendHtml(
$req,
@ -151,14 +164,13 @@ sub check {
$self->p->checkXSSAttack( 'URL', $url ) ? ""
: $url
),
ALLOWED => $auth,
ALERTE_AUTH =>
( $auth eq 'allowed' ? 'alert-success' : 'alert-danger' ),
HEADERS => $array_hdrs,
ATTRIBUTES => $array_attrs->[2],
MACROS => $array_attrs->[1],
GROUPS => $array_attrs->[0],
TOKEN => (
ALLOWED => $auth,
ALERTE_AUTH => $alert_auth,
HEADERS => $array_hdrs,
ATTRIBUTES => $array_attrs->[2],
MACROS => $array_attrs->[1],
GROUPS => $array_attrs->[0],
TOKEN => (
$self->conf->{requireToken}
? $self->ott->createToken( $req->sessionInfo )
: ''
@ -190,8 +202,7 @@ sub display {
MSG => 'checkUser',
ALERTE => 'alert-info',
LOGIN => (
$self->p->checkXSSAttack( 'LOGIN', $req->{user} )
? ""
$self->p->checkXSSAttack( 'LOGIN', $req->{user} ) ? ""
: $req->{user}
),
TOKEN => (
@ -227,10 +238,22 @@ sub _userDatas {
sub _authorization {
my ( $self, $req, $uri ) = @_;
my ( $vhost, $appuri ) = $uri =~ m#^https?://([^/]*)(.*)#;
my $exist = 0;
$vhost =~ s/:\d+$//;
$appuri ||= '/';
return $self->p->HANDLER->grant( $req, $req->{sessionInfo}, $appuri,
undef, $vhost );
foreach my $vh ( keys %{$self->conf->{locationRules}} ) {
if ( $vh eq $vhost ) {
$exist = 1;
$self->logger->debug("VirtualHost: $vh found in Conf");
last;
}
}
return $exist
? $self->p->HANDLER->grant( $req, $req->{sessionInfo}, $appuri,
undef, $vhost )
: -1;
}
sub _headers {

View File

@ -117,7 +117,7 @@
"changeKey":"Generate new key",
"changePwd":"غير كلمة المرور الخاصة بك",
"checkLastLogins":"تحقق من آخر تسجيلات دخول الخاصة بي",
"checkUser":"Check user session",
"checkUser":"Check user SSO profile",
"choose2f":"Choose your second factor",
"chooseApp":"اختر أحد التطبيقات المسموح لك بالدخول إليها",
"clickHere":"الرجاء الضغط هنا",
@ -212,6 +212,7 @@
"resetPwd":"إعادة تعيين كلمة المرور الخاصة بي",
"rightsReloadNeedsLogout":" إعادة تحميل الحقوق تحتاج إلى تسجيل الخروج وتسجيل الدخول مرة أخرى",
"scope":"Scope",
"search":"Search",
"selectIdP":"اختر موفر الهوية الخاص بك",
"service":"Service",
"sendPwd":"Send me a link",
@ -239,6 +240,7 @@
"useYubikey":"استخدم اليوبي كي الخاص بك",
"value":"Value",
"verify":"التحقق",
"VHnotFound":"Virtual Host not found",
"wait":"انتظر",
"warning":"تحذير",
"welcomeOnPortal":"مرحبا بك على بوابة إثبات الهوية الآمنة.",

View File

@ -117,7 +117,7 @@
"changeKey":"Neuen Schlüssel erzeugen",
"changePwd":"Ändere dein Passwort",
"checkLastLogins":"Überprüfe meine letzten Logins",
"checkUser":"Check user session",
"checkUser":"Check user SSO profile",
"choose2f":"Wählen deinen Ihren zweiten Faktor",
"chooseApp":"Wählen Sie eine Anwendung aus, auf die du zugreifen darfst",
"clickHere":"Bitte hier klicken",
@ -212,6 +212,7 @@
"resetPwd":"Mein Passwort zurücksetzen",
"rightsReloadNeedsLogout":"Zum Neuladen der Rechte musst du dich ab- und wieder anmelden",
"scope":"Scope",
"search":"Search",
"selectIdP":"Wähle deinen Identitätsanbieter aus",
"service":"Dienst",
"sendPwd":"Send me a link",
@ -239,6 +240,7 @@
"useYubikey":"use your Yubikey",
"value":"Value",
"verify":"Verify",
"VHnotFound":"Virtual Host not found",
"wait":"Warten",
"warning":"Warnung",
"welcomeOnPortal":"Willkommen in Ihrem gesicherten Authentifizierungsportal.",

View File

@ -117,7 +117,7 @@
"changeKey": "Generate new key",
"changePwd":"Change your password",
"checkLastLogins":"Check my last logins",
"checkUser":"Check user session",
"checkUser":"Check user SSO profile",
"choose2f":"Choose your second factor",
"chooseApp":"Choose an application your are allowed to access to",
"clickHere":"Please click here",
@ -211,7 +211,8 @@
"resentConfirm":"Do you want the confirmation mail to be resent?",
"resetPwd":"Reset my password",
"rightsReloadNeedsLogout": "Rights reloads need to logout and login again",
"scope": "Scope",
"scope":"Scope",
"search":"Search",
"selectIdP":"Select your Identity Provider",
"service":"Service",
"sendPwd":"Send me a link",
@ -239,6 +240,7 @@
"useYubikey":"use your Yubikey",
"value":"Value",
"verify": "Verify",
"VHnotFound":"Virtual Host not found",
"wait":"Wait",
"warning":"Warning",
"welcomeOnPortal":"Welcome on your secured authentication portal.",

View File

@ -117,7 +117,7 @@
"changeKey":"Generate new key",
"changePwd":"Change your password",
"checkLastLogins":"Check my last logins",
"checkUser":"Check user session",
"checkUser":"Check user SSO profile",
"choose2f":"Choose your second factor",
"chooseApp":"Choose an application your are allowed to access to",
"clickHere":"Please click here",
@ -212,6 +212,7 @@
"resetPwd":"Reset my password",
"rightsReloadNeedsLogout":"Rights reloads need to logout and login again",
"scope":"Scope",
"search":"Search",
"selectIdP":"Select your Identity Provider",
"service":"Service",
"sendPwd":"Send me a link",
@ -239,6 +240,7 @@
"useYubikey":"use your Yubikey",
"value":"Value",
"verify":"Verify",
"VHnotFound":"Virtual Host not found",
"wait":"Wait",
"warning":"Warning",
"welcomeOnPortal":"Welcome on your secured authentication portal.",

View File

@ -117,7 +117,7 @@
"changeKey": "Générer une nouvelle clef",
"changePwd":"Changez votre mot de passe",
"checkLastLogins":"Voir mes dernières connexions",
"checkUser":"Vérifier la session d'un utilisateur",
"checkUser":"Vérifier le profil SSO d'un utilisateur",
"choose2f":"Choisissez votre second facteur",
"chooseApp":"Choisissez une application à laquelle vous êtes autorisé à accéder",
"clickHere":"Cliquez ici",
@ -212,6 +212,7 @@
"resetPwd":"Réinitialiser mon mot de passe",
"rightsReloadNeedsLogout": "Le rechargement des droits nécessite une déconnexion",
"scope": "Informations",
"search":"Chercher",
"selectIdP":"Choisissez votre fournisseur d'identité",
"service":"Service",
"sendPwd":"Envoyez-moi un lien",
@ -239,6 +240,7 @@
"useYubikey":"Utilisez votre Yubikey",
"value":"Valeur",
"verify": "Vérifier",
"VHnotFound":"Hôte virtuel erroné ou inexistant",
"wait":"Attendre",
"warning":"Attention",
"welcomeOnPortal":"Bienvenue sur votre portail d'authentification sécurisée.",

View File

@ -117,7 +117,7 @@
"changeKey":"Genera nuova chiave",
"changePwd":"Cambia la tua password",
"checkLastLogins":"Controllare i miei ultimi accessi",
"checkUser":"Check user session",
"checkUser":"Check user SSO profile",
"choose2f":"Scegli il tuo secondo fattore",
"chooseApp":"Scegli un'applicazione alla quale ti è consentito l'accesso",
"clickHere":"Per favore clicka qui",
@ -212,6 +212,7 @@
"resetPwd":"Reimpostare la password",
"rightsReloadNeedsLogout":"Le ricariche dei diritti necessitano di disconnettersi e di riconnettersi",
"scope":"Ambito",
"search":"Search",
"selectIdP":"Seleziona il tuo provider di identità",
"service":"Servizio",
"sendPwd":"Inviami il link",
@ -239,6 +240,7 @@
"useYubikey":"Usa la tua Yubikey",
"value":"Value",
"verify":"Verifica",
"VHnotFound":"Virtual Host not found",
"wait":"Attendere",
"warning":"Avvertimento",
"welcomeOnPortal":"Benvenuto sul tuo portale di autenticazione protetta.",

View File

@ -117,7 +117,7 @@
"changeKey":"Generate new key",
"changePwd":"Change your password",
"checkLastLogins":"Check my last logins",
"checkUser":"Check user session",
"checkUser":"Check user SSO profile",
"choose2f":"Choose your second factor",
"chooseApp":"Choose an application your are allowed to access to",
"clickHere":"Please click here",
@ -212,6 +212,7 @@
"resetPwd":"Reset my password",
"rightsReloadNeedsLogout":"Rights reloads need to logout and login again",
"scope":"Scope",
"search":"Search",
"selectIdP":"Select your Identity Provider",
"service":"Service",
"sendPwd":"Send me a link",
@ -239,6 +240,7 @@
"useYubikey":"use your Yubikey",
"value":"Value",
"verify":"Verify",
"VHnotFound":"Virtual Host not found",
"wait":"Wait",
"warning":"Warning",
"welcomeOnPortal":"Welcome on your secured authentication portal.",

View File

@ -117,7 +117,7 @@
"changeKey":"Generate new key",
"changePwd":"Change your password",
"checkLastLogins":"Check my last logins",
"checkUser":"Check user session",
"checkUser":"Check user SSO profile",
"choose2f":"Choose your second factor",
"chooseApp":"Choose an application your are allowed to access to",
"clickHere":"Please click here",
@ -212,6 +212,7 @@
"resetPwd":"Reset my password",
"rightsReloadNeedsLogout":"Rights reloads need to logout and login again",
"scope":"Scope",
"search":"Search",
"selectIdP":"Select your Identity Provider",
"service":"Service",
"sendPwd":"Send me a link",
@ -239,6 +240,7 @@
"useYubikey":"use your Yubikey",
"value":"Value",
"verify":"Verify",
"VHnotFound":"Virtual Host not found",
"wait":"Wait",
"warning":"Warning",
"welcomeOnPortal":"Welcome on your secured authentication portal.",

View File

@ -117,7 +117,7 @@
"changeKey":"Generate new key",
"changePwd":"Change your password",
"checkLastLogins":"Check my last logins",
"checkUser":"Check user session",
"checkUser":"Check user SSO profile",
"choose2f":"Choose your second factor",
"chooseApp":"Choose an application your are allowed to access to",
"clickHere":"Please click here",
@ -212,6 +212,7 @@
"resetPwd":"Reset my password",
"rightsReloadNeedsLogout":"Rights reloads need to logout and login again",
"scope":"Scope",
"search":"Search",
"selectIdP":"Select your Identity Provider",
"service":"Service",
"sendPwd":"Send me a link",
@ -239,6 +240,7 @@
"useYubikey":"use your Yubikey",
"value":"Value",
"verify":"Verify",
"VHnotFound":"Virtual Host not found",
"wait":"Wait",
"warning":"Warning",
"welcomeOnPortal":"Welcome on your secured authentication portal.",

View File

@ -117,7 +117,7 @@
"changeKey":"Generate new key",
"changePwd":"Thay đổi mật khẩu của bạn",
"checkLastLogins":"Kiểm tra lần đăng nhập cuối cùng của bạn",
"checkUser":"Check user session",
"checkUser":"Check user SSO profile",
"choose2f":"Choose your second factor",
"chooseApp":"Chọn một ứng dụng bạn được phép truy cập vào",
"clickHere":"Vui lòng nhấp vào đây",
@ -212,6 +212,7 @@
"resetPwd":"Đặt lại mật khẩu của tôi",
"rightsReloadNeedsLogout":"Tải lại quyền cần đăng xuất và đăng nhập lại",
"scope":"Scope",
"search":"Search",
"selectIdP":"Chọn bộ cung cấp danh tính của bạn",
"service":"Service",
"sendPwd":"Send me a link",
@ -239,6 +240,7 @@
"useYubikey":"sử dụng Yubikey của bạn",
"value":"Value",
"verify":"Xác minh",
"VHnotFound":"Virtual Host not found",
"wait":"Hãy đợi",
"warning":"Cảnh báo",
"welcomeOnPortal":"Chào mừng bạn đến với cổng thông tin xác thực được bảo mật của bạn.",

View File

@ -117,7 +117,7 @@
"changeKey":"Generate new key",
"changePwd":"修改您的密码",
"checkLastLogins":"Check my last logins",
"checkUser":"Check user session",
"checkUser":"Check user SSO profile",
"choose2f":"Choose your second factor",
"chooseApp":"Choose an application your are allowed to access to",
"clickHere":"请点击这里",
@ -212,6 +212,7 @@
"resetPwd":"重置我的密码",
"rightsReloadNeedsLogout":"Rights reloads need to logout and login again",
"scope":"Scope",
"search":"Search",
"selectIdP":"Select your Identity Provider",
"service":"Service",
"sendPwd":"Send me a link",
@ -239,6 +240,7 @@
"useYubikey":"使用您的 Yubikey",
"value":"Value",
"verify":"验证",
"VHnotFound":"Virtual Host not found",
"wait":"等待",
"warning":"警告",
"welcomeOnPortal":"欢迎来到您的加密认证 portal",

View File

@ -6,6 +6,7 @@
-->
<div class="alert <TMPL_VAR NAME="ALERTE"> alert"><span trspan="<TMPL_VAR NAME="MSG">"></span></div>
<form id="checkuser" action="/checkuser" method="post" class="password" role="form">
<div class="buttons">
<TMPL_IF NAME="TOKEN">
<input type="hidden" name="token" value="<TMPL_VAR NAME="TOKEN">" />
@ -21,26 +22,23 @@
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-link"></i> </span>
</div>
<input name="url" type="text" class="form-control" value="<TMPL_VAR NAME="URL">" trplaceholder="http://auth.example.com" aria-required="true"/>
<input name="url" type="text" class="form-control" value="<TMPL_VAR NAME="URL">" trplaceholder="https://auth.example.com" aria-required="true"/>
</div>
<button type="submit" class="btn btn-success">
<span class="fa fa-search"></span>
<span trspan="search">Search</span>
</button>
</div>
&nbsp;
<TMPL_IF NAME="ALLOWED">
<div class="alert <TMPL_VAR NAME="ALERTE_AUTH">"><span trspan="<TMPL_VAR NAME="ALLOWED">"></span></div>
</TMPL_IF>
<TMPL_IF NAME="HEADERS">
<div class="buttons">
<button type="submit" class="btn btn-success">
<span class="fa fa-sign-in"></span>
<span trspan="checkUser">Check user</span>
</button>
</div>
<div>&nbsp;</div>
<div class="card mb-3 border-secondary">
<div class="card-body table-responsive">
<table class="table table-hover">
<thead>
<tr class="align-middle"><span trspan="headers">HEADERS</span></tr>
<tr class="align-middle"><b><span trspan="headers">HEADERS</span></b></tr>
<tr>
<th class="align-middle"><span trspan="key">Key</span></th>
<th class="align-middle"><span trspan="value">Value</span></th>
@ -62,11 +60,11 @@
<div class="container">
<div class="row">
<TMPL_IF NAME="GROUPS">
<div class="card col-md-4 border-secondary">
<div class="card col-md-2 border-secondary">
<div class="card-body table-responsive">
<table class="table table-hover">
<thead>
<tr class="align-middle"><span trspan="groups_sso">GROUPS SSO</span></tr>
<tr class="align-middle"><b><span trspan="groups_sso">SSO GROUPS</span></b></tr>
</thead>
<tbody>
<TMPL_LOOP NAME="GROUPS">
@ -85,7 +83,7 @@
<div class="card-body table-responsive">
<table class="table table-hover">
<thead>
<tr class="align-middle"><span trspan="macros">MACROS</span></tr>
<tr class="align-middle"><b><span trspan="macros">MACROS</span></b></tr>
<tr>
<th class="align-middle"><span trspan="key">Key</span></th>
<th class="align-middle"><span trspan="value">Value</span></th>
@ -105,21 +103,21 @@
</TMPL_IF>
<TMPL_IF NAME="ATTRIBUTES">
<div class="card col-md-4 border-secondary">
<div class="card col-md-6 border-secondary">
<div class="card-body table-responsive">
<table class="table table-hover">
<thead>
<tr class="align-middle"><span trspan="attributes">ATTRIBUTES</span></tr>
<tr class="align-middle"><b><span trspan="attributes">ATTRIBUTES</span></b></tr>
<tr>
<th class="align-middle"><span trspan="key">Key</span></th>
<th class="align-middle"><span trspan="value">Value</span></th>
<th class="text-left"><span trspan="key">Key</span></th>
<th class="text-left"><span trspan="value">Value</span></th>
</tr>
</thead>
<tbody>
<TMPL_LOOP NAME="ATTRIBUTES">
<tr>
<td class="align-middle"><TMPL_VAR NAME="key"></td>
<td class="align-middle"><TMPL_VAR NAME="value"></td>
<td class="text-left"><TMPL_VAR NAME="key"></td>
<td class="text-left"><TMPL_VAR NAME="value"></td>
</tr>
</TMPL_LOOP>
</tbody>
@ -131,10 +129,12 @@
</div>
<div class="buttons">
<!--
<button type="submit" class="btn btn-success">
<span class="fa fa-sign-in"></span>
<span trspan="checkUser">Check user</span>
<span trspan="search">Search</span>
</button>
-->
<a href="<TMPL_VAR NAME="PORTAL_URL">" class="btn btn-primary" role="button">
<span class="fa fa-home"></span>
<span trspan="goToPortal">Go to portal</span>