Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Maxime Besson
lemonldap-ng
Commits
8de024dd
Commit
8de024dd
authored
Jul 04, 2018
by
Yadd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prepare cookie storage for #1461
parent
60d05c48
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
2 deletions
+27
-2
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Request.pm
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Request.pm
+4
-1
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm
+23
-1
No files found.
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Request.pm
View file @
8de024dd
...
...
@@ -22,6 +22,9 @@ has id => ( is => 'rw' );
has
sessionInfo
=>
(
is
=>
'
rw
'
);
has
user
=>
(
is
=>
'
rw
'
);
# Persistent data (stored in cookie during auth, erased when auth is ready)
has
pdata
=>
(
is
=>
'
rw
'
);
# Response cookies (list of strings built by cookie())
has
respCookies
=>
(
is
=>
'
rw
'
);
...
...
@@ -113,7 +116,7 @@ sub error_type {
sub
init
{
my
(
$self
)
=
@_
;
$self
->
{
$_
}
=
{}
foreach
(
qw(datas customParameters sessionInfo)
);
$self
->
{
$_
}
=
{}
foreach
(
qw(datas customParameters sessionInfo
pdata
)
);
$self
->
{
$_
}
=
[]
foreach
(
qw(respCookies)
);
}
...
...
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm
View file @
8de024dd
...
...
@@ -31,9 +31,31 @@ sub sessionDatas {
# - launch Lemonldap::NG::Common::PSGI::Request::handler()
sub
handler
{
my
(
$self
,
$req
)
=
@_
;
bless
$req
,
'
Lemonldap::NG::Portal::Main::Request
';
$req
->
init
();
return
$self
->
Lemonldap::NG::Common::PSGI::Router::
handler
(
$req
);
# Restore pdata
if
(
my
$v
=
$req
->
cookies
->
{
$self
->
conf
->
{
cookieName
}
.
'
pdata
'
}
)
{
eval
{
$req
->
pdata
(
JSON::
from_json
(
$v
)
);
};
if
(
$@
)
{
$self
->
logger
->
error
("
Bad JSON content in cookie pdata
");
$req
->
pdata
(
{}
);
}
}
my
$res
=
$self
->
Lemonldap::NG::Common::PSGI::Router::
handler
(
$req
);
# Save pdata
my
%v
=
(
name
=>
$self
->
conf
->
{
cookieName
}
.
'
pdata
',
(
%
{
$req
->
pdata
}
?
(
value
=>
JSON::
to_json
(
$req
->
pdata
)
)
:
(
value
=>
'',
expires
=>
'
Wed, 21 Oct 2015 00:00:00 GMT
'
)
)
);
push
@
{
$res
->
[
1
]
},
'
Set-Cookie
',
$self
->
cookie
(
%v
);
return
$res
;
}
# MAIN ENTRY POINTS (declared in Lemonldap::NG::Portal::Main::Init)
...
...
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