Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Maxime Besson
lemonldap-ng
Commits
ca16584d
Commit
ca16584d
authored
Apr 03, 2016
by
Yadd
Browse files
#595 in progress...
parent
80f17a91
Changes
10
Hide whitespace changes
Inline
Side-by-side
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/Demo.pm
View file @
ca16584d
...
...
@@ -26,7 +26,7 @@ sub init {
"
Using demonstration mode, go in Manager to edit the configuration
",
'
warn
'
);
PE_OK
;
1
;
}
## @apmethod int authenticate()
...
...
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/_WebForm.pm
View file @
ca16584d
...
...
@@ -7,10 +7,11 @@ package Lemonldap::NG::Portal::Auth::_WebForm;
use
strict
;
use
Mouse
;
use
Lemonldap::NG::Portal::Main::
Constants
;
our
$VERSION
=
'
2.0.0
';
extends
Lemonldap::NG::Portal::Main::
Auth
;
extends
'
Lemonldap::NG::Portal::Main::Auth
'
;
## @apmethod int authInit()
# Does nothing.
...
...
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main.pm
View file @
ca16584d
...
...
@@ -6,7 +6,6 @@ use Mouse;
our
$VERSION
=
'
2.0.0
';
extends
(
'
Lemonldap::NG::Handler::PSGI::Try
',
'
Lemonldap::NG::Portal::Main::Init
',
'
Lemonldap::NG::Portal::Main::Run
',
);
...
...
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Init.pm
View file @
ca16584d
...
...
@@ -13,9 +13,13 @@ use Mouse;
use
Lemonldap::NG::Common::Conf::
Constants
;
use
Lemonldap::NG::Handler::Main::
Reload
qw/keepConf/
;
use
Lemonldap::NG::Portal::Main::
Plugins
;
use
Regexp::
Assemble
;
our
$VERSION
=
'
2.0.0
';
extends
'
Lemonldap::NG::Handler::PSGI::Try
',
'
Lemonldap::NG::Portal::Main::Plugins
';
use
constant
HANDLER
=>
'
Lemonldap::NG::Handler::PSGI::API
';
# Configuration storage
...
...
@@ -30,6 +34,9 @@ has _userDB => ( is => 'rw' );
has
_macros
=>
(
is
=>
'
rw
'
);
has
_groups
=>
(
is
=>
'
rw
'
);
# TrustedDomain regexp
has
trustedDomains
=>
(
is
=>
'
rw
'
);
# Lists to store plugins entry-points
has
beforeAuth
=>
(
is
=>
'
rw
',
...
...
@@ -80,7 +87,7 @@ sub init {
sub
reloadConf
{
my
(
$self
)
=
@_
;
my
$conf
=
HANDLER
->
lmConf
->
{
cfgNum
}
;
my
$conf
=
HANDLER
->
lmConf
;
# Delete keys that will be generated
foreach
my
$key
(
...
...
@@ -135,10 +142,12 @@ sub reloadConf {
and
$self
->
{"
_
$type
"}
->
init
);
}
$self
->
_authentication
->
authnLevel
(
$self
->
conf
->
{
$self
->
conf
->
authentication
.
"
AuthnLevel
"
}
);
$self
->
conf
->
{
$self
->
conf
->
{
authentication
}
.
"
AuthnLevel
"
}
);
# Initialize trusted domain regexp
if
(
$self
->
conf
->
{
trustedDomains
}
=~
/^\s*\*\s*$/
)
{
if
(
$self
->
conf
->
{
trustedDomains
}
and
$self
->
conf
->
{
trustedDomains
}
=~
/^\s*\*\s*$/
)
{
$self
->
trustedDomains
(
qr#^https?://#
);
}
else
{
...
...
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Process.pm
View file @
ca16584d
...
...
@@ -121,8 +121,8 @@ sub setSessionInfo {
my
(
$self
,
$req
)
=
@_
;
# Get the current user module
$req
->
{
sessionInfo
}
->
{
_auth
}
=
$self
->
getModule
("
auth
");
$req
->
{
sessionInfo
}
->
{
_userDB
}
=
$self
->
getModule
("
user
");
$req
->
{
sessionInfo
}
->
{
_auth
}
=
$self
->
getModule
(
$req
,
"
auth
"
);
$req
->
{
sessionInfo
}
->
{
_userDB
}
=
$self
->
getModule
(
$req
,
"
user
"
);
# Store IP address from remote address or X-FORWARDED-FOR header
$req
->
{
sessionInfo
}
->
{
ipAddr
}
=
$req
->
remote_ip
;
...
...
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm
View file @
ca16584d
...
...
@@ -66,19 +66,19 @@ sub pleaseAuth {
sub
login
{
my
(
$self
,
$req
)
=
@_
;
return
$
req
->
do
(
return
$
self
->
do
(
$req
,
[
'
controlUrl
',
@
{
$self
->
beforeAuth
},
&authProcess
,
@
{
$self
->
betweenAuthAndDatas
},
&sessionDatas
,
@
{
$self
->
after
d
atas
},
&sessionDatas
,
@
{
$self
->
after
D
atas
},
]
);
}
sub
postLogin
{
my
(
$self
,
$req
)
=
@_
;
return
$
req
->
do
(
return
$
self
->
do
(
$req
,
[
'
restoreArgs
',
'
controlUrl
',
...
...
@@ -91,7 +91,7 @@ sub postLogin {
sub
authenticatedRequest
{
my
(
$self
,
$req
)
=
@_
;
return
$
req
->
do
(
$req
,
$self
->
forAuthUser
);
return
$
self
->
do
(
$req
,
$self
->
forAuthUser
);
}
# RUNNING METHODS
...
...
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/Demo.pm
View file @
ca16584d
...
...
@@ -6,8 +6,11 @@
package
Lemonldap::NG::Portal::UserDB::
Demo
;
use
strict
;
use
Mouse
;
use
Lemonldap::NG::Portal::Main::
Constants
;
extends
Lemonldap::NG::Portal::Main::
Module
;
our
$VERSION
=
'
2.0.0
';
## @apmethod int userDBInit()
...
...
@@ -16,7 +19,7 @@ our $VERSION = '2.0.0';
sub
init
{
my
$self
=
shift
;
unless
(
$self
->
get
_m
odule
('
auth
')
=~
/^Demo/
)
{
unless
(
$self
->
p
->
get
M
odule
(
undef
,
'
auth
'
)
=~
/^Demo/
)
{
$self
->
lmLog
(
"
Use UserDBDemo only with AuthDemo
",
'
error
'
);
return
PE_ERROR
;
}
...
...
@@ -40,7 +43,7 @@ sub init {
},
};
PE_OK
;
1
;
}
## @apmethod int getUser()
...
...
lemonldap-ng-portal/t/01-AuthDemo.t
View file @
ca16584d
...
...
@@ -3,6 +3,6 @@ use strict;
require
'
t/test-lib.pm
';
print
STDERR
Dumper
(
&client
);
print
STDERR
Dumper
(
&client
->
_get
('
/
')
);
done_testing
(
count
()
);
lemonldap-ng-portal/t/lmConf-1.js
View file @
ca16584d
...
...
@@ -51,6 +51,7 @@
"
macros
"
:
{
"
_whatToTrace
"
:
"
$_auth eq 'SAML' ?
\"
$_user
\\
@$_idpConfKey
\"
:
\"
$_user
\"
"
},
"
notifications
"
:
0
,
"
portal
"
:
"
http://auth.example.com/
"
,
"
reloadUrls
"
:
{},
"
userDB
"
:
"
Demo
"
,
...
...
lemonldap-ng-portal/t/test-lib.pm
View file @
ca16584d
...
...
@@ -16,7 +16,7 @@ ok(
app
=>
Lemonldap::NG::Portal::
Main
->
run
(
{
configStorage
=>
{
type
=>
'
File
',
dirName
=>
'
t
'
},
logLevel
=>
'
warn
',
logLevel
=>
'
debug
',
cookieName
=>
'
lemonldap
',
securedCookie
=>
0
,
https
=>
0
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment