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
8af86353
Commit
8af86353
authored
Apr 01, 2016
by
Yadd
Browse files
#595 in progress
parent
78f074bd
Changes
6
Hide whitespace changes
Inline
Side-by-side
_example/etc/portal-apache2.4.conf
View file @
8af86353
...
...
@@ -22,6 +22,12 @@
PerlResponseHandler
ModPerl
::
Registry
</
Files
>
# Temporary hook
<
Files
*.
psgi
>
SetHandler
fcgid
-
script
Options
+
ExecCGI
</
Files
>
<
IfModule
mod_dir
.
c
>
DirectoryIndex
index
.
pl
index
.
html
</
IfModule
>
...
...
_example/etc/portal-apache2.X.conf
View file @
8af86353
...
...
@@ -28,6 +28,12 @@
PerlResponseHandler
ModPerl
::
Registry
</
Files
>
# Temporary hook
<
Files
*.
psgi
>
SetHandler
fcgid
-
script
Options
+
ExecCGI
</
Files
>
<
IfModule
mod_dir
.
c
>
DirectoryIndex
index
.
pl
index
.
html
</
IfModule
>
...
...
_example/etc/portal-apache2.conf
View file @
8af86353
...
...
@@ -23,6 +23,12 @@
PerlResponseHandler
ModPerl
::
Registry
</
Files
>
# Temporary hook
<
Files
*.
psgi
>
SetHandler
fcgid
-
script
Options
+
ExecCGI
</
Files
>
<
IfModule
mod_dir
.
c
>
DirectoryIndex
index
.
pl
index
.
html
</
IfModule
>
...
...
lemonldap-ng-portal/example/index.fcgi
View file @
8af86353
#!/usr/bin/perl
#!/usr/bin/
env
perl
use
Lemonldap::NG::Common::
CGI
qw(fastcgi)
;
use
Lemonldap::NG::Portal::
SharedConf
;
use
HTML::
Template
;
use
strict
;
use
Plack::Handler::
FCGI
;
use
Lemonldap::NG::Portal::
Main
;
LMAUTH:
while
(
my
$portal
=
Lemonldap::NG::Portal::
SharedConf
->
new
(
{
# ACCESS TO CONFIGURATION
# By default, Lemonldap::NG uses the default lemonldap-ng.ini file to
# know where to find its configuration
# (generaly /etc/lemonldap-ng/lemonldap-ng.ini)
# You can specify by yourself this file :
#configStorage => { confFile => '/path/to/my/file' },
# or set explicitely parameters :
#configStorage => {
# type => 'File',
# dirName => '/usr/local/lemonldap-ng/data//conf'
#},
# Note that YOU HAVE TO SET configStorage here if you've declared this
# portal as SOAP configuration server in the manager
# OTHERS
# You can also overload any parameter issued from manager
# configuration. Example:
#globalStorage => 'Apache::Session::File',
#globalStorageOptions => {
# 'Directory' => '/var/lib/lemonldap-ng/sessions/',
# 'LockDirectory' => '/var/lib/lemonldap-ng/sessions/lock/',
#},
# Note that YOU HAVE TO SET globalStorage here if you've declared this
# portal as SOAP session server in the manager
}
)
)
{
# Get skin and template parameters
my
(
$templateName
,
%templateParams
)
=
$portal
->
display
();
# HTML template creation
my
$template
=
HTML::
Template
->
new
(
filename
=>
"
$templateName
",
die_on_bad_params
=>
0
,
cache
=>
0
,
global_vars
=>
1
,
loop_context_vars
=>
1
,
filter
=>
[
sub
{
$portal
->
translate_template
(
@
_
)
},
sub
{
$portal
->
session_template
(
@
_
)
}
],
);
# Give parameters to the template
while
(
my
(
$k
,
$v
)
=
each
%templateParams
)
{
$template
->
param
(
$k
,
$v
);
}
# Display it
print
$portal
->
header
('
text/html; charset=utf-8
');
print
$template
->
output
;
}
# Roll your own
my
$server
=
Plack::Handler::
FCGI
->
new
();
$server
->
run
(
Lemonldap::NG::Portal::
Main
->
run
(
{}
)
);
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Init.pm
View file @
8af86353
...
...
@@ -123,15 +123,8 @@ sub reloadConf {
$self
->
error
("
$type
is not set
");
return
0
;
}
my
$module
=
ucfirst
(
$type
)
.
$self
->
conf
->
{
$type
};
$module
=~
s/\s.*$//
;
$module
=~
s/^Authentication/Auth/
;
$module
=
"
Lemonldap::NG::Portal::
$module
";
# $self->conf->{authentication} and $self->conf->{userDB} can
# contains arguments (key1 = scalar_value; key2 = ...)
my
(
$tmp
,
%h
)
=
split
(
/\s*[=;]\s*/
,
$self
->
conf
->
{
$type
}
);
%
{
$self
->
{
conf
}
}
=
(
%h
,
%
{
$self
->
{
conf
}
}
)
if
(
%h
);
my
$module
=
'
::
'
.
ucfirst
(
$type
)
.
'
::
'
.
$self
->
conf
->
{
$type
};
$module
=~
s/Authentication/Auth/
;
# Launch and initialize module
return
0
...
...
@@ -168,7 +161,7 @@ sub loadPlugin {
my
$obj
;
return
0
unless
(
$obj
=
$self
->
loadModule
("
Lemonldap::NG::Portal::Plugins::
$plugin
")
);
$self
->
loadModule
("
$plugin
")
);
foreach
my
$sub
(
qw(beforeAuthProcess addSessionData afterAuthProcess forAuthUser)
)
{
...
...
@@ -184,6 +177,7 @@ sub loadPlugin {
sub
loadModule
{
my
(
$self
,
$module
)
=
@_
;
my
$obj
;
$module
=
"
Lemonldap::NG::Portal
$module
"
if
(
$module
=~
/^::/
);
eval
"
require
$module
";
if
(
$@
)
{
...
...
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Plugins.pm
View file @
8af86353
...
...
@@ -18,7 +18,7 @@ sub enabledPlugins {
foreach
my
$key
(
qw(SAML OpenID CAS OpenIDConnect)
)
{
if
(
$self
->
conf
->
{"
issuerDB
${key}
Activation
"}
)
{
$self
->
lmlog
(
"
IssuerDB
${key}
enabled
",
'
debug
'
);
push
@res
,
"
IssuerDB
$key
";
push
@res
,
"
::
IssuerDB
::
$key
";
}
}
...
...
@@ -29,7 +29,7 @@ sub enabledPlugins {
{
if
(
$self
->
conf
->
{
$key
}
)
{
$self
->
lmLog
(
'
Captcha enabled
',
'
debug
'
);
push
@res
,
'
Captcha
';
push
@res
,
'
::Plugins::
Captcha
';
last
;
}
}
...
...
@@ -39,17 +39,17 @@ sub enabledPlugins {
push
@res
,
'
SOAP
'
if
(
$self
->
conf
->
{
Soap
}
);
# Check if notification is enabled
push
@res
,
'
Notifications
'
if
(
$self
->
conf
->
{
notification
}
);
push
@res
,
'
::Plugins::
Notifications
'
if
(
$self
->
conf
->
{
notification
}
);
foreach
my
$type
(
qw(password register)
)
{
my
$tmp
=
$self
->
conf
->
{
$type
};
if
(
$tmp
and
$tmp
ne
'
Null
'
)
{
$tmp
=
ucfirst
(
$type
)
.
"
DB
$tmp
";
$tmp
=
'
::
'
.
ucfirst
(
$type
)
.
"
DB
::
$tmp
";
$self
->
lmLog
("
$tmp
enabled
");
push
@res
,
$tmp
;
}
}
push
@res
,
'
GrantSession
'
if
(
$self
->
conf
->
{
grantSessionRule
}
);
push
@res
,
'
::Plugins::
GrantSession
'
if
(
$self
->
conf
->
{
grantSessionRule
}
);
# TODO: Password
...
...
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