Commit d50775a5 authored by Christophe Maudoux's avatar Christophe Maudoux 🐛

Append add & verify button + update lang

parent 1e74b271
......@@ -52,7 +52,7 @@ sub delSession {
return $self->sendJSONresponse( $req, { result => 1 } );
}
sub delU2FKey {
sub deleteU2FKey {
my ( $self, $req ) = @_;
return $self->sendJSONresponse( $req, { result => 1 } )
if ( $self->{demoMode} );
......@@ -77,6 +77,56 @@ sub delU2FKey {
return $self->sendJSONresponse( $req, { result => 1 } );
}
sub addU2FKey {
my ( $self, $req ) = @_;
return $self->sendJSONresponse( $req, { result => 1 } )
if ( $self->{demoMode} );
my $mod = $self->getMod($req)
or return $self->sendError( $req, undef, 400 );
my $id = $req->params('sessionId')
or return $self->sendError( $req, 'sessionId is missing', 400 );
# Try to read session
my $session = $self->getApacheSession( $mod, $id )
or return $self->sendError( $req, undef, 400 );
# Delete U2F key attributs and update session
$session->data->{_u2fKeyHandle} = 'TOF';
$session->data->{_u2fUserKey} = 'TOF';
$session->update( \%{ $session->data } );
Lemonldap::NG::Handler::PSGI::Main->localUnlog( $req, $id );
if ( $session->error ) {
return $self->sendError( $req, $session->error, 200 );
}
return $self->sendJSONresponse( $req, { result => 1 } );
}
sub verifyU2FKey {
my ( $self, $req ) = @_;
return $self->sendJSONresponse( $req, { result => 1 } )
if ( $self->{demoMode} );
my $mod = $self->getMod($req)
or return $self->sendError( $req, undef, 400 );
my $id = $req->params('sessionId')
or return $self->sendError( $req, 'sessionId is missing', 400 );
# Try to read session
my $session = $self->getApacheSession( $mod, $id )
or return $self->sendError( $req, undef, 400 );
# Delete U2F key attributs and update session
$session->data->{_u2fKeyHandle} = 'OK';
$session->data->{_u2fUserKey} = 'OK';
$session->update( \%{ $session->data } );
Lemonldap::NG::Handler::PSGI::Main->localUnlog( $req, $id );
if ( $session->error ) {
return $self->sendError( $req, $session->error, 200 );
}
return $self->sendJSONresponse( $req, { result => 1 } );
}
sub session {
my ( $self, $req, $id, $skey ) = @_;
my ( %h, $res );
......
......@@ -37,17 +37,23 @@ sub addRoutes {
['GET']
)
# DELETE U2F KEY ATTRIBUTS
# DELETE U2F KEY
->addRoute(
u2f => { ':sessionType' => { ':sessionId' => 'delU2FKey' } },
u2f => { ':sessionType' => { ':sessionId' => 'deleteU2FKey' } },
['DELETE']
);
)
# UPDATE U2F KEY ATTRIBUTS
# ->addRoute(
# u2f => { ':sessionType' => { ':sessionId' => { ':updateSession' } },
# ['PUT']
#);
# ADD U2F KEY
->addRoute(
u2f => { ':sessionType' => { ':sessionId' => 'addU2FKey' } },
['PUT']
)
# VERIFY U2F KEY
->addRoute(
u2f => { ':sessionType' => { ':sessionId' => 'verifyU2FKey' } },
['POST']
);
$self->setTypes($conf);
......
......@@ -87,10 +87,18 @@ categories =
# Menu entries
menu =
session: [
delU2FKey: [
title: 'deleteU2FKey'
icon: 'trash'
]
addU2FKey: [
title: 'addU2FKey'
icon: 'plus'
]
verifyU2FKey: [
title: 'verifyU2FKey'
icon: 'check'
]
home: []
###
......@@ -138,7 +146,7 @@ llapp.controller 'SessionsExplorerCtrl', ['$scope', '$translator', '$location',
# SESSION MANAGEMENT
# Delete U2F key attributs
# Delete U2F key
$scope.deleteU2FKey = ->
$scope.waiting = true
$http['delete']("#{scriptname}u2f/#{sessionType}/#{$scope.currentSession.id}").then (response) ->
......@@ -151,6 +159,32 @@ llapp.controller 'SessionsExplorerCtrl', ['$scope', '$translator', '$location',
$scope.waiting = false
$scope.showT = true
# Add U2F key
$scope.addU2FKey = ->
$scope.waiting = true
$http['put']("#{scriptname}u2f/#{sessionType}/#{$scope.currentSession.id}").then (response) ->
$scope.currentSession = null
#$scope.currentScope.remove()
$scope.waiting = false
, (resp) ->
$scope.currentSession = null
#$scope.currentScope.remove()
$scope.waiting = false
$scope.showT = true
# Verify U2F key
$scope.verifyU2FKey = ->
$scope.waiting = true
$http['post']("#{scriptname}u2f/#{sessionType}/#{$scope.currentSession.id}").then (response) ->
$scope.currentSession = null
#$scope.currentScope.remove()
$scope.waiting = false
, (resp) ->
$scope.currentSession = null
#$scope.currentScope.remove()
$scope.waiting = false
$scope.showT = true
# Open node
$scope.stoggle = (scope) ->
node = scope.$modelValue
......@@ -197,8 +231,8 @@ llapp.controller 'SessionsExplorerCtrl', ['$scope', '$translator', '$location',
session[key] = $scope.localeDate value
else if key.match /^(_startTime|_updateTime)$/
session[key] = _stToStr value
else if key.match /^(_u2fKeyHandle|_u2fUserKey)$/
session[key] = '########'
#else if key.match /^(_u2fKeyHandle|_u2fUserKey)$/
# session[key] = '########'
res = []
# 2. Push session keys in result, grouped by categories
......
......@@ -104,12 +104,24 @@
};
menu = {
session: [
delU2FKey: [
{
title: 'deleteU2FKey',
icon: 'trash'
}
],
addU2FKey: [
{
title: 'addU2FKey',
icon: 'plus'
}
],
verifyU2FKey: [
{
title: 'verifyU2FKey',
icon: 'check'
}
],
home: []
};
......@@ -173,6 +185,28 @@
});
return $scope.showT = true;
};
$scope.addU2FKey = function() {
$scope.waiting = true;
$http['put'](scriptname + "u2f/" + sessionType + "/" + $scope.currentSession.id).then(function(response) {
$scope.currentSession = null;
return $scope.waiting = false;
}, function(resp) {
$scope.currentSession = null;
return $scope.waiting = false;
});
return $scope.showT = true;
};
$scope.verifyU2FKey = function() {
$scope.waiting = true;
$http['post'](scriptname + "u2f/" + sessionType + "/" + $scope.currentSession.id).then(function(response) {
$scope.currentSession = null;
return $scope.waiting = false;
}, function(resp) {
$scope.currentSession = null;
return $scope.waiting = false;
});
return $scope.showT = true;
};
$scope.stoggle = function(scope) {
var node;
node = scope.$modelValue;
......@@ -226,8 +260,6 @@
session[key] = $scope.localeDate(value);
} else if (key.match(/^(_startTime|_updateTime)$/)) {
session[key] = _stToStr(value);
} else if (key.match(/^(_u2fKeyHandle|_u2fUserKey)$/)) {
session[key] = '########';
}
}
}
......
......@@ -33,6 +33,7 @@
"addSamlAttribute":"إضافة صفة",
"addSPSamlPartner":"إضافة SP SAML",
"addSrvCasPartner":"إضافة سرفر كاس",
"addU2FKey":"Add U2F key",
"addVhost":"إضافة خادم افتراضي",
"adParams":"معاييرأكتيف ديريكتوري",
"ADPwdExpireWarning":"تحذير انتهاء صلاحية كلمة المرور",
......@@ -752,6 +753,7 @@
"values":"القيم",
"variables":"المتغيرات",
"version":"الإصدار",
"verifyU2FKey":"Verify U2F key",
"vhostAliases":"اسماء مستعارة",
"vhostAuthnLevel":"مستوى إثبات الهوية واجب",
"vhostHttps":"إتش تي تي بي س",
......
......@@ -33,6 +33,7 @@
"addSamlAttribute":"Add attribute",
"addSPSamlPartner":"Add SAML SP",
"addSrvCasPartner":"Add CAS server",
"addU2FKey":"Add U2F key",
"addVhost":"Add virtualhost",
"adParams":"Active Directory Parameters",
"ADPwdExpireWarning":"Password expire warning",
......@@ -752,6 +753,7 @@
"values":"Values",
"variables":"Variables",
"version":"Version",
"verifyU2FKey":"Verify U2F key",
"vhostAliases":"Aliases",
"vhostAuthnLevel":"Required authentication level",
"vhostHttps":"HTTPS",
......
......@@ -33,6 +33,7 @@
"addSamlAttribute":"Ajouter un attribut",
"addSPSamlPartner":"Ajouter un SP SAML",
"addSrvCasPartner":"Ajouter un serveur CAS",
"addU2FKey":"Ajouter une clef U2F",
"addVhost":"Ajouter un hôte virtuel",
"adParams":"Paramètres Active Directory",
"ADPwdExpireWarning":"Avertissement avant expiration du mot de passe",
......@@ -751,6 +752,7 @@
"value":"Valeur",
"values":"Valeurs",
"variables":"Variables",
"verifyU2FKey":"Vérifier la clef U2F",
"version":"Version",
"vhostAliases":"Alias",
"vhostAuthnLevel":"Niveau d'authentication requis",
......
......@@ -33,6 +33,7 @@
"addSamlAttribute":"Aggiungi attributo",
"addSPSamlPartner":"Aggiungi SAML SP",
"addSrvCasPartner":"Aggiungi server CAS",
"addU2FKey":"Add U2F key",
"addVhost":"Aggiungi virtualhost",
"adParams":"Parametri di Active Directory",
"ADPwdExpireWarning":"Avviso di scadenza password",
......@@ -752,6 +753,7 @@
"values":"Valori",
"variables":"Variabili",
"version":"Versioni",
"verifyU2FKey":"Verify U2F key",
"vhostAliases":"Alias",
"vhostAuthnLevel":"Livello di autenticazione richiesto",
"vhostHttps":"HTTPS",
......
......@@ -33,6 +33,7 @@
"addSamlAttribute":"Thêm thuộc tính",
"addSPSamlPartner":"Thêm SAML SP",
"addSrvCasPartner":"Thêm máy chủ CAS",
"addU2FKey":"Add U2F key",
"addVhost":"Thêm host ảo",
"adParams":"Tham số của Active Directory",
"ADPwdExpireWarning":"Cảnh báo mật khẩu hết hạn",
......@@ -752,6 +753,7 @@
"values":"Giá trị",
"variables":"biến",
"version":"Phiên bản",
"verifyU2FKey":"Verify U2F key",
"vhostAliases":"Bí danh",
"vhostAuthnLevel":"Mức xác thực bắt buộc",
"vhostHttps":"HTTPS",
......
......@@ -40,8 +40,10 @@
<!-- Menu buttons -->
<div class="lmmenu navbar navbar-default" ng-class="{'hidden-xs':!showM}">
<div class="navbar-collapse" ng-class="{'collapse':!showM}" id="formmenu">
<ul class="nav navbar-nav">
<li ng-if="currentSession" ng-repeat="button in menu.session" ng-include="'menubutton.html'"></li>
<ul class="nav navbar-nav">
<li ng-if="currentSession" ng-repeat="button in menu.addU2FKey" ng-include="'menubutton.html'"></li>
<li ng-if="currentSession" ng-repeat="button in menu.verifyU2FKey" ng-include="'menubutton.html'"></li>
<li ng-if="currentSession" ng-repeat="button in menu.delU2FKey" ng-include="'menubutton.html'"></li>
<li ng-if="currentSession===null" ng-repeat="button in menu.home" ng-include="'menubutton.html'"></li>
<li uib-dropdown class="visible-xs">
<a id="langmenu" name="menu" uib-dropdown-toggle data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Menu <span class="caret"></span></a>
......
......@@ -197,7 +197,7 @@
"touchU2fDevice": "Please touch the flashing U2F device now.",
"u2fFailed": "U2F verification failed. Retry or contact your administrator",
"u2fPermission": "You may be prompted to allow the site permission to access your security keys. After granting permission, the device will start to blink.",
"u2fRegistered": "Your key is registered. Click to verify.",
"u2fRegistered": "Your key has been registered. CLICK TO VERIFY !",
"u2fUnregistered": "Your key has been unregistered.",
"u2fSuccess": "Your key is successfully tested",
"u2fWelcome": "U2F device management",
......
......@@ -197,7 +197,7 @@
"touchU2fDevice": "Poser votre doigt sur le périphérique U2F",
"u2fFailed": "La vérification U2F a échoué, réessayez ou contactez votre administrateur",
"u2fPermission": "Il est possible qu'on vous demande d'autoriser le site à accéder à votre clef. Après votre accord, la clef clignotera.",
"u2fRegistered": "Votre clef est enregistrée. Cliquez sur vérifier",
"u2fRegistered": "Votre clef a été enregistrée. CLIQUEZ SUR VÉRIFIER !",
"u2fUnregistered": "Votre clef a été supprimée.",
"u2fSuccess": "Votre clef est vérifiée",
"u2fWelcome": "Gestion du périphérique U2F",
......@@ -206,7 +206,7 @@
"upgradeSession":"Se réauthentifier",
"user":"Utilisateur",
"useYubikey":"utilisez votre Yubikey",
"verify": "Verifier",
"verify": "Vérifier",
"wait":"Attendre",
"warning":"Attention",
"welcomeOnPortal":"Bienvenue sur votre portail d'authentification sécurisée.",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment