Commit 31398c78 authored by Christophe Maudoux's avatar Christophe Maudoux 🐛

WIP - delete U2F key attributes from manager with U2F module

parent 26d4667f
......@@ -318,7 +318,7 @@ Examples:
$self->addRoute( books => { ':bookId' => 'book' }, ['GET'] );
booId parameter will be stored in $req->params('bookId');
bookId parameter will be stored in $req->params('bookId');
=item to manage http://.../books/127/pages/5 with page(), use:
......
......@@ -50,6 +50,35 @@ sub delSession {
return $self->sendJSONresponse( $req, { result => 1 } );
}
sub delU2FKey {
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 $apacheSession = $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 );
Lemonldap::NG::Handler::PSGI::Main->localUnlog( $req, $id );
if ( $apacheSession->error ) {
return $self->sendError( $req, $apacheSession->error, 200 );
}
return $self->sendJSONresponse( $req, { result => 1 } );
}
sub session {
my ( $self, $req, $id, $skey ) = @_;
my ( %h, $res );
......
......@@ -33,17 +33,17 @@ sub addRoutes {
# READ
->addRoute( sessions => { ':sessionType' => 'sessions' }, ['GET'] )
# UPDATE
# DELETEU2FKey
->addRoute(
sessions => { ':sessionType' => { ':sessionId' => 'delSession' } },
['PUT']
)
sessions => { ':sessionType' => { ':sessionId' => 'delU2FKey' } },
['POST']
);
# DELETE
->addRoute(
sessions => { ':sessionType' => { ':sessionId' => 'delSession' } },
['DELETE']
);
#~ ->addRoute(
#~ sessions => { ':sessionType' => { ':sessionId' => 'delSession' } },
#~ ['DELETE']
#);
$self->setTypes($conf);
......
......@@ -138,16 +138,16 @@ llapp.controller 'SessionsExplorerCtrl', ['$scope', '$translator', '$location',
# SESSION MANAGEMENT
# Delete
# Delete U2F Key
$scope.deleteU2FKey = ->
$scope.waiting = true
$http['put']("#{scriptname}sessions/#{sessionType}/#{$scope.currentSession.id}").then (response) ->
# $scope.currentSession = null
# $scope.currentScope.remove()
$http['post']("#{scriptname}sessions/#{sessionType}/#{$scope.currentSession.id}").then (response) ->
$scope.currentSession = null
$scope.currentScope.remove()
$scope.waiting = false
, (resp) ->
# $scope.currentSession = null
# $scope.currentScope.remove()
$scope.currentSession = null
$scope.currentScope.remove()
$scope.waiting = false
# Open node
......
......@@ -164,9 +164,13 @@
};
$scope.deleteU2FKey = function() {
$scope.waiting = true;
return $http['put'](scriptname + "sessions/" + sessionType + "/" + $scope.currentSession.id).then(function(response) {
return $http['post'](scriptname + "sessions/" + sessionType + "/" + $scope.currentSession.id).then(function(response) {
$scope.currentSession = null;
$scope.currentScope.remove();
return $scope.waiting = false;
}, function(resp) {
$scope.currentSession = null;
$scope.currentScope.remove();
return $scope.waiting = false;
});
};
......
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