Commit 9dfce47d authored by Christophe Maudoux's avatar Christophe Maudoux

WIP - Append U2F module to manage users U2F Key (delete only at the moment)

parent 31398c78
node_modules
e2e-tests/conf/
lemonldap-ng-common/MYMETA.json
lemonldap-ng-common/MYMETA.yml
lemonldap-ng-common/Makefile
lemonldap-ng-common/blib/
lemonldap-ng-common/pm_to_blib
lemonldap-ng-handler/MYMETA.json
lemonldap-ng-handler/MYMETA.yml
lemonldap-ng-handler/Makefile
lemonldap-ng-handler/blib/
lemonldap-ng-handler/pm_to_blib
lemonldap-ng-manager/MYMETA.json
lemonldap-ng-manager/MYMETA.yml
lemonldap-ng-manager/Makefile
lemonldap-ng-manager/blib/
lemonldap-ng-manager/pm_to_blib
lemonldap-ng-portal/MYMETA.json
lemonldap-ng-portal/MYMETA.yml
lemonldap-ng-portal/Makefile
lemonldap-ng-portal/blib/
lemonldap-ng-portal/t/
.gitignore
lemonldap-ng-portal/pm_to_blib
e2e-tests/lemonldap-ng.ini
......@@ -32,6 +32,7 @@ useRedirectOnError = 0
[manager]
enabledModules = conf, sessions, notifications, U2F
protection = manager
staticPrefix = /static
languages = fr, en, vi, ar
......
......@@ -33,6 +33,8 @@ sub hAttr {
$_[0]->{hiddenAttributes} || $_[0]->conf->{hiddenAttributes};
}
### SEE LEMONLDAP::NG::COMMON::SESSION FOR AVAILABLE FUNCTIONS
sub delSession {
my ( $self, $req ) = @_;
return $self->sendJSONresponse( $req, { result => 1 } )
......@@ -61,20 +63,17 @@ sub delU2FKey {
# Try to read session
my $apacheSession = $self->getApacheSession( $mod, $id )
my $session = $self->getApacheSession( $mod, $id )
or return $self->sendError( $req, undef, 400 );
my %session = %{ $apacheSession->data };
$session{_session_uid} = 'TOTO';
$apacheSession->update(\%session);
#return $self->sendError( $req, $session->data->{_session_uid}, 666 );
# 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 ( $apacheSession->error ) {
return $self->sendError( $req, $apacheSession->error, 200 );
if ( $session->error ) {
return $self->sendError( $req, $session->error, 200 );
}
return $self->sendJSONresponse( $req, { result => 1 } );
}
......
......@@ -90,7 +90,7 @@ sub init {
$self->defaultRoute( $working[0]->defaultRoute );
my $linksIcons =
{ 'conf' => 'cog', 'sessions' => 'duplicate', 'notifications' => 'bell' };
{ 'conf' => 'cog', 'sessions' => 'duplicate', 'notifications' => 'bell', 'U2F' => 'wrench' };
$self->links( [] );
for ( my $i = 0 ; $i < @links ; $i++ ) {
......
......@@ -31,19 +31,19 @@ sub addRoutes {
$self->addRoute( 'u2f.html', undef, ['GET'] )
# READ
->addRoute( sessions => { ':sessionType' => 'sessions' }, ['GET'] )
->addRoute( u2f => { ':sessionType' => 'sessions' }, ['GET'] )
# DELETEU2FKey
# DELETE U2F KEY ATTRIBUTS
->addRoute(
sessions => { ':sessionType' => { ':sessionId' => 'delU2FKey' } },
['POST']
u2f => { ':sessionType' => { ':sessionId' => 'delU2FKey' } },
['DELETE']
);
# DELETE
#~ ->addRoute(
#~ sessions => { ':sessionType' => { ':sessionId' => 'delSession' } },
#~ ['DELETE']
#);
# UPDATE U2F KEY ATTRIBUTS
# ->addRoute(
# u2f => { ':sessionType' => { ':sessionId' => { ':updateSession' } },
# ['PUT']
#);
$self->setTypes($conf);
......@@ -56,7 +56,7 @@ sub addRoutes {
# II. DISPLAY METHODS #
#######################
sub sessions {
sub u2f {
my ( $self, $req, $session, $skey ) = @_;
# Case 1: only one session is required
......
###
# U2F manager
# Session explorer
###
# Max number of session to display (see overScheme)
......@@ -119,7 +119,7 @@ llapp.controller 'SessionsExplorerCtrl', ['$scope', '$translator', '$location',
$scope.translate = $translator.translate
$scope.translateTitle = (node) ->
$translator.translateField node, 'title'
sessionType = 'Persistent'
sessionType = 'global'
# Handle menu items
$scope.menuClick = (button) ->
......@@ -138,10 +138,10 @@ llapp.controller 'SessionsExplorerCtrl', ['$scope', '$translator', '$location',
# SESSION MANAGEMENT
# Delete U2F Key
# Delete
$scope.deleteU2FKey = ->
$scope.waiting = true
$http['post']("#{scriptname}sessions/#{sessionType}/#{$scope.currentSession.id}").then (response) ->
$http['delete']("#{scriptname}u2f/#{sessionType}/#{$scope.currentSession.id}").then (response) ->
$scope.currentSession = null
$scope.currentScope.remove()
$scope.waiting = false
......
// Generated by CoffeeScript 1.10.0
// Generated by CoffeeScript 1.9.3
/*
* Session explorer
......
// Generated by CoffeeScript 1.9.3
/*
* U2F manager
* Session explorer
*/
(function() {
......@@ -141,7 +141,7 @@
$scope.translateTitle = function(node) {
return $translator.translateField(node, 'title');
};
sessionType = 'Persistent';
sessionType = 'global';
$scope.menuClick = function(button) {
if (button.popup) {
window.open(button.popup);
......@@ -164,7 +164,7 @@
};
$scope.deleteU2FKey = function() {
$scope.waiting = true;
return $http['post'](scriptname + "sessions/" + sessionType + "/" + $scope.currentSession.id).then(function(response) {
return $http['delete'](scriptname + "u2f/" + sessionType + "/" + $scope.currentSession.id).then(function(response) {
$scope.currentSession = null;
$scope.currentScope.remove();
return $scope.waiting = false;
......
<TMPL_INCLUDE NAME="header.tpl">
<title>LemonLDAP::NG U2F manager</title>
<title>LemonLDAP::NG sessions explorer</title>
</head>
<body ng-app="llngSessionsExplorer" ng-controller="SessionsExplorerCtrl" ng-csp>
......@@ -15,7 +15,6 @@
<div class="navbar navbar-default">
<div class="navbar-collapse">
<ul class="nav navbar-nav" role="grid">
<!--
<li uib-dropdown>
<a id="navsso" name="menu" uib-dropdown-toggle data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="glyphicon glyphicon-user"></i> {{translate('ssoSessions')}} <span class="caret"></span></a>
<ul uib-dropdown-menu aria-labelled-by="navsso">
......@@ -26,7 +25,6 @@
<li><a id="a-updatetime" href="#/_updateTime" role="row"><i class="glyphicon glyphicon-hourglass"></i> {{translate('_updateTime')}}</a></li>
</ul>
</li>
-->
<li><a id="a-persistent" href="#/persistent" role="row"><i class="glyphicon glyphicon-exclamation-sign"></i> {{translate('persistentSessions')}}</a></li>
</ul>
</div>
......
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