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