WIP - delete U2F key attributes from manager with U2F module
This commit is contained in:
parent
26d4667fd2
commit
31398c78bc
|
@ -318,7 +318,7 @@ Examples:
|
||||||
|
|
||||||
$self->addRoute( books => { ':bookId' => 'book' }, ['GET'] );
|
$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:
|
=item to manage http://.../books/127/pages/5 with page(), use:
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,35 @@ sub delSession {
|
||||||
return $self->sendJSONresponse( $req, { result => 1 } );
|
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 {
|
sub session {
|
||||||
my ( $self, $req, $id, $skey ) = @_;
|
my ( $self, $req, $id, $skey ) = @_;
|
||||||
my ( %h, $res );
|
my ( %h, $res );
|
||||||
|
|
|
@ -33,17 +33,17 @@ sub addRoutes {
|
||||||
# READ
|
# READ
|
||||||
->addRoute( sessions => { ':sessionType' => 'sessions' }, ['GET'] )
|
->addRoute( sessions => { ':sessionType' => 'sessions' }, ['GET'] )
|
||||||
|
|
||||||
# UPDATE
|
# DELETEU2FKey
|
||||||
->addRoute(
|
->addRoute(
|
||||||
sessions => { ':sessionType' => { ':sessionId' => 'delSession' } },
|
sessions => { ':sessionType' => { ':sessionId' => 'delU2FKey' } },
|
||||||
['PUT']
|
['POST']
|
||||||
)
|
);
|
||||||
|
|
||||||
# DELETE
|
# DELETE
|
||||||
->addRoute(
|
#~ ->addRoute(
|
||||||
sessions => { ':sessionType' => { ':sessionId' => 'delSession' } },
|
#~ sessions => { ':sessionType' => { ':sessionId' => 'delSession' } },
|
||||||
['DELETE']
|
#~ ['DELETE']
|
||||||
);
|
#);
|
||||||
|
|
||||||
$self->setTypes($conf);
|
$self->setTypes($conf);
|
||||||
|
|
||||||
|
|
|
@ -138,16 +138,16 @@ llapp.controller 'SessionsExplorerCtrl', ['$scope', '$translator', '$location',
|
||||||
|
|
||||||
# SESSION MANAGEMENT
|
# SESSION MANAGEMENT
|
||||||
|
|
||||||
# Delete
|
# Delete U2F Key
|
||||||
$scope.deleteU2FKey = ->
|
$scope.deleteU2FKey = ->
|
||||||
$scope.waiting = true
|
$scope.waiting = true
|
||||||
$http['put']("#{scriptname}sessions/#{sessionType}/#{$scope.currentSession.id}").then (response) ->
|
$http['post']("#{scriptname}sessions/#{sessionType}/#{$scope.currentSession.id}").then (response) ->
|
||||||
# $scope.currentSession = null
|
$scope.currentSession = null
|
||||||
# $scope.currentScope.remove()
|
$scope.currentScope.remove()
|
||||||
$scope.waiting = false
|
$scope.waiting = false
|
||||||
, (resp) ->
|
, (resp) ->
|
||||||
# $scope.currentSession = null
|
$scope.currentSession = null
|
||||||
# $scope.currentScope.remove()
|
$scope.currentScope.remove()
|
||||||
$scope.waiting = false
|
$scope.waiting = false
|
||||||
|
|
||||||
# Open node
|
# Open node
|
||||||
|
|
|
@ -164,9 +164,13 @@
|
||||||
};
|
};
|
||||||
$scope.deleteU2FKey = function() {
|
$scope.deleteU2FKey = function() {
|
||||||
$scope.waiting = true;
|
$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;
|
return $scope.waiting = false;
|
||||||
}, function(resp) {
|
}, function(resp) {
|
||||||
|
$scope.currentSession = null;
|
||||||
|
$scope.currentScope.remove();
|
||||||
return $scope.waiting = false;
|
return $scope.waiting = false;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user