Commit a0ea56a2 authored by Xavier Guimard's avatar Xavier Guimard

SOAP/REST in progress (#970)

parent d1646392
...@@ -2,6 +2,26 @@ package Lemonldap::NG::Common::Session::REST; ...@@ -2,6 +2,26 @@ package Lemonldap::NG::Common::Session::REST;
use strict; use strict;
use Mouse; use Mouse;
use Lemonldap::NG::Common::Conf::Constants;
has sessionTypes => ( is => 'rw' );
sub setTypes {
my ( $self, $conf ) = @_;
foreach my $type (@sessionTypes) {
if ( my $tmp =
$self->{ $type . 'Storage' } || $conf->{ $type . 'Storage' } )
{
$self->{sessionTypes}->{$type}->{module} = $tmp;
$self->{sessionTypes}->{$type}->{options} =
$self->{ $type . 'StorageOptions' }
|| $conf->{ $type . 'StorageOptions' }
|| {};
$self->{sessionTypes}->{$type}->{kind} =
( $type eq 'global' ? 'SSO' : ucfirst($type) );
}
}
}
sub separator { sub separator {
$_[0]->{multiValuesSeparator} || $_[0]->conf->{multiValuesSeparator}; $_[0]->{multiValuesSeparator} || $_[0]->conf->{multiValuesSeparator};
...@@ -30,7 +50,7 @@ sub delSession { ...@@ -30,7 +50,7 @@ sub delSession {
sub session { sub session {
my ( $self, $req, $id, $skey ) = @_; my ( $self, $req, $id, $skey ) = @_;
my ( %h, $res ); my ( %h, $res );
return $self->sendError( $req, 'Bad request', 400 ) unless($id); return $self->sendError( $req, 'Bad request', 400 ) unless ($id);
my $mod = $self->getMod($req) my $mod = $self->getMod($req)
or return $self->sendError( $req, undef, 400 ); or return $self->sendError( $req, undef, 400 );
...@@ -85,7 +105,7 @@ sub getMod { ...@@ -85,7 +105,7 @@ sub getMod {
$self->error('Session type is required'); $self->error('Session type is required');
return (); return ();
} }
unless ( $m = $self->conf->{$s} ) { unless ( $m = $self->sessionTypes->{$s} ) {
$self->error('Unknown (or unconfigured) session type'); $self->error('Unknown (or unconfigured) session type');
return (); return ();
} }
......
...@@ -13,9 +13,8 @@ use Lemonldap::NG::Manager::Constants; ...@@ -13,9 +13,8 @@ use Lemonldap::NG::Manager::Constants;
use feature 'state'; use feature 'state';
extends 'Lemonldap::NG::Common::Conf::AccessLib', 'Lemonldap::NG::Common::Session::REST'; extends 'Lemonldap::NG::Common::Conf::AccessLib',
'Lemonldap::NG::Common::Session::REST';
has conf => ( is => 'rw', isa => 'HashRef', default => sub { {} } );
our $VERSION = '2.0.0'; our $VERSION = '2.0.0';
...@@ -50,19 +49,7 @@ sub addRoutes { ...@@ -50,19 +49,7 @@ sub addRoutes {
# #
# Return unless configuration is available # Return unless configuration is available
return 0 unless ($conf); return 0 unless ($conf);
foreach my $type (@sessionTypes) { $self->setTypes($conf);
if ( my $tmp =
$self->{ $type . 'Storage' } || $conf->{ $type . 'Storage' } )
{
$self->{conf}->{$type}->{module} = $tmp;
$self->{conf}->{$type}->{options} =
$self->{ $type . 'StorageOptions' }
|| $conf->{ $type . 'StorageOptions' }
|| {};
$self->{conf}->{$type}->{kind} =
( $type eq 'global' ? 'SSO' : ucfirst($type) );
}
}
$self->{ipField} ||= 'ipAddr'; $self->{ipField} ||= 'ipAddr';
$self->{multiValuesSeparator} ||= '; '; $self->{multiValuesSeparator} ||= '; ';
......
...@@ -1268,19 +1268,6 @@ ...@@ -1268,19 +1268,6 @@
"_nodes": [{ "_nodes": [{
"id": "customFunctions", "id": "customFunctions",
"title": "customFunctions" "title": "customFunctions"
}, {
"_nodes": [{
"default": 0,
"id": "Soap",
"title": "Soap",
"type": "bool"
}, {
"id": "exportedAttr",
"title": "exportedAttr"
}],
"id": "soap",
"title": "soap",
"type": "simpleInputContainer"
}, { }, {
"_nodes": [{ "_nodes": [{
"default": 1, "default": 1,
......
...@@ -1444,20 +1444,6 @@ ...@@ -1444,20 +1444,6 @@
"nodes": [{ "nodes": [{
"id": "customFunctions", "id": "customFunctions",
"title": "customFunctions" "title": "customFunctions"
}, {
"id": "soap",
"title": "soap",
"type": "simpleInputContainer",
"nodes": [{
"default": 0,
"id": "Soap",
"title": "Soap",
"type": "bool",
"data": 0
}, {
"id": "exportedAttr",
"title": "exportedAttr"
}]
}, { }, {
"id": "loginHistory", "id": "loginHistory",
"title": "loginHistory", "title": "loginHistory",
......
...@@ -1455,20 +1455,6 @@ ...@@ -1455,20 +1455,6 @@
"nodes": [{ "nodes": [{
"id": "customFunctions", "id": "customFunctions",
"title": "customFunctions" "title": "customFunctions"
}, {
"id": "soap",
"title": "soap",
"type": "simpleInputContainer",
"nodes": [{
"default": 0,
"id": "Soap",
"title": "Soap",
"type": "bool",
"data": 0
}, {
"id": "exportedAttr",
"title": "exportedAttr"
}]
}, { }, {
"id": "loginHistory", "id": "loginHistory",
"title": "loginHistory", "title": "loginHistory",
......
...@@ -1444,20 +1444,6 @@ ...@@ -1444,20 +1444,6 @@
"nodes": [{ "nodes": [{
"id": "customFunctions", "id": "customFunctions",
"title": "customFunctions" "title": "customFunctions"
}, {
"id": "soap",
"title": "soap",
"type": "simpleInputContainer",
"nodes": [{
"default": 0,
"id": "Soap",
"title": "Soap",
"type": "bool",
"data": 0
}, {
"id": "exportedAttr",
"title": "exportedAttr"
}]
}, { }, {
"id": "loginHistory", "id": "loginHistory",
"title": "loginHistory", "title": "loginHistory",
......
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