Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
lemonldap-ng
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xavier Bachelot
lemonldap-ng
Commits
96263e0e
Commit
96263e0e
authored
Mar 03, 2017
by
Xavier Guimard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean repo
parent
98e9e3a9
Changes
33
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
126 additions
and
99 deletions
+126
-99
e2e-tests/handler/11-logout_app_sso.js
e2e-tests/handler/11-logout_app_sso.js
+1
-1
lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Backends/JSONFile.pm
...-common/lib/Lemonldap/NG/Common/Conf/Backends/JSONFile.pm
+1
-1
lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Constants.pm
...nldap-ng-common/lib/Lemonldap/NG/Common/Conf/Constants.pm
+1
-1
lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/ReConstants.pm
...dap-ng-common/lib/Lemonldap/NG/Common/Conf/ReConstants.pm
+1
-1
lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Lib/ServiceToken.pm
...p-ng-handler/lib/Lemonldap/NG/Handler/Lib/ServiceToken.pm
+6
-6
lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Main/Reload.pm
lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Main/Reload.pm
+1
-1
lemonldap-ng-handler/t/64-Lemonldap-NG-Handler-PSGI-DevOps.t
lemonldap-ng-handler/t/64-Lemonldap-NG-Handler-PSGI-DevOps.t
+33
-9
lemonldap-ng-manager/lib/Lemonldap/NG/Manager.pm
lemonldap-ng-manager/lib/Lemonldap/NG/Manager.pm
+1
-1
lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Attributes.pm
lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Attributes.pm
+0
-7
lemonldap-ng-manager/site/htdocs/static/reverseTree.json
lemonldap-ng-manager/site/htdocs/static/reverseTree.json
+1
-1
lemonldap-ng-manager/site/htdocs/static/struct.json
lemonldap-ng-manager/site/htdocs/static/struct.json
+1
-1
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/SAML.pm
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/SAML.pm
+2
-3
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Issuer/OpenIDConnect.pm
...ng-portal/lib/Lemonldap/NG/Portal/Issuer/OpenIDConnect.pm
+12
-7
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/Notifications/XML.pm
...g-portal/lib/Lemonldap/NG/Portal/Lib/Notifications/XML.pm
+3
-5
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/OpenIDConnect.pm
...ap-ng-portal/lib/Lemonldap/NG/Portal/Lib/OpenIDConnect.pm
+4
-4
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/REST.pm
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/REST.pm
+3
-3
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/SAML.pm
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/SAML.pm
+1
-1
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm
+1
-1
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Password/LDAP.pm
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Password/LDAP.pm
+2
-2
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Password/REST.pm
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Password/REST.pm
+8
-4
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/SOAPServer.pm
...p-ng-portal/lib/Lemonldap/NG/Portal/Plugins/SOAPServer.pm
+2
-2
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Register/Demo.pm
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Register/Demo.pm
+3
-3
lemonldap-ng-portal/t/21-Auth-and-password-LDAP.t
lemonldap-ng-portal/t/21-Auth-and-password-LDAP.t
+10
-10
lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Artifact-with-SOAP-SLO-IdP-initiated.t
...th-and-issuer-SAML-Artifact-with-SOAP-SLO-IdP-initiated.t
+2
-3
lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Artifact-with-SOAP-SLO.t
...portal/t/30-Auth-and-issuer-SAML-Artifact-with-SOAP-SLO.t
+1
-1
lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-POST-IdP-initiated.t
...-ng-portal/t/30-Auth-and-issuer-SAML-POST-IdP-initiated.t
+2
-3
lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-POST.t
lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-POST.t
+1
-1
lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Redirect-IdP-initiated.t
...portal/t/30-Auth-and-issuer-SAML-Redirect-IdP-initiated.t
+2
-3
lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Redirect.t
lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Redirect.t
+1
-1
lemonldap-ng-portal/t/32-Auth-and-issuer-OIDC-authorization_code.t
...-ng-portal/t/32-Auth-and-issuer-OIDC-authorization_code.t
+1
-0
lemonldap-ng-portal/t/40-Notifications-XML-Server.t
lemonldap-ng-portal/t/40-Notifications-XML-Server.t
+2
-1
lemonldap-ng-portal/t/test-ldap.pm
lemonldap-ng-portal/t/test-ldap.pm
+12
-7
lemonldap-ng-portal/t/test-lib.pm
lemonldap-ng-portal/t/test-lib.pm
+4
-4
No files found.
e2e-tests/handler/11-logout_app_sso.js
View file @
96263e0e
...
...
@@ -13,4 +13,4 @@ describe('Lemonldap::NG', function() {
expect
(
browser
.
getCurrentUrl
()).
toMatch
(
new
RegExp
(
'
^http://auth.example.com(:
'
+
process
.
env
.
TESTWEBSERVERPORT
+
'
)?/
\\
?url=aHR0cDovL3Rlc3QxLmV4YW1wbGUuY29tOjE5ODc2Lw==
'
));
});
});
});
});
\ No newline at end of file
lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Backends/JSONFile.pm
View file @
96263e0e
...
...
@@ -4,7 +4,7 @@ package Lemonldap::NG::Common::Conf::Backends::JSONFile;
use
Lemonldap::NG::Common::Conf::
File
;
our
@ISA
=
qw(Lemonldap::NG::Common::Conf::Backends::File)
;
our
@ISA
=
qw(Lemonldap::NG::Common::Conf::Backends::File)
;
our
$VERSION
=
'
2.0.0
';
1
;
...
...
lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Constants.pm
View file @
96263e0e
...
...
@@ -23,7 +23,7 @@ use constant HANDLERSECTION => "handler";
use
constant
MANAGERSECTION
=>
"
manager
";
use
constant
SESSIONSEXPLORERSECTION
=>
"
sessionsExplorer
";
use
constant
APPLYSECTION
=>
"
apply
";
our
$hashParameters
=
qr/^(?:(?:l(?:o(?:ca(?:lSessionStorageOption|tionRule)|goutService)|dapExportedVar|wp(?:Ssl)?Opt)|(?:(?:d(?:emo|bi)|facebook|webID)ExportedVa|exported(?:Heade|Va))r|g(?:r(?:antSessionRule|oup)|lobalStorageOption)|n(?:otificationStorageOption|ginxCustomHandler)|c(?:as(?:StorageOption|Attribute)|ombModule)|re(?:moteGlobalStorageOption|loadUrl)|CAS_proxiedService|macro)s|o(?:idc(?:RPMetaData(?:(?:Option(?:sExtraClaim)?|ExportedVar)s|Node)|OPMetaData(?:(?:ExportedVar|Option)s|J(?:SON|WKS)|Node)|S(?:erviceMetaDataAuthnContext|torageOptions))|penIdExportedVars)|s(?:aml(?:S(?:PMetaData(?:(?:ExportedAttribute|Option)s|Node|XML)|torageOptions)|IDPMetaData(?:(?:ExportedAttribute|Option)s|Node|XML))|
(?:laveExportedVar|TokenScope)s|essionDataToRemember
)|p(?:ersistentStorageOptions|o(?:rtalSkinRules|st))|a(?:uthChoiceModules|pplicationList)|v(?:hostOptions|irtualHost)|SSLVarIf)$/
;
our
$hashParameters
=
qr/^(?:(?:l(?:o(?:ca(?:lSessionStorageOption|tionRule)|goutService)|dapExportedVar|wp(?:Ssl)?Opt)|(?:(?:d(?:emo|bi)|facebook|webID)ExportedVa|exported(?:Heade|Va))r|g(?:r(?:antSessionRule|oup)|lobalStorageOption)|n(?:otificationStorageOption|ginxCustomHandler)|c(?:as(?:StorageOption|Attribute)|ombModule)|re(?:moteGlobalStorageOption|loadUrl)|CAS_proxiedService|macro)s|o(?:idc(?:RPMetaData(?:(?:Option(?:sExtraClaim)?|ExportedVar)s|Node)|OPMetaData(?:(?:ExportedVar|Option)s|J(?:SON|WKS)|Node)|S(?:erviceMetaDataAuthnContext|torageOptions))|penIdExportedVars)|s(?:aml(?:S(?:PMetaData(?:(?:ExportedAttribute|Option)s|Node|XML)|torageOptions)|IDPMetaData(?:(?:ExportedAttribute|Option)s|Node|XML))|
essionDataToRemember|laveExportedVars
)|p(?:ersistentStorageOptions|o(?:rtalSkinRules|st))|a(?:uthChoiceModules|pplicationList)|v(?:hostOptions|irtualHost)|SSLVarIf)$/
;
our
@sessionTypes
=
(
'
remoteGlobal
',
'
cas
',
'
global
',
'
localSession
',
'
persistent
',
'
saml
',
'
oidc
'
);
...
...
lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/ReConstants.pm
View file @
96263e0e
...
...
@@ -20,7 +20,7 @@ our $specialNodeHash = {
};
our
$doubleHashKeys
=
'
issuerDBGetParameters
';
our
$simpleHashKeys
=
'
(?:(?:l(?:o(?:calSessionStorageOption|goutService)|dapExportedVar|wp(?:Ssl)?Opt)|(?:(?:d(?:emo|bi)|facebook|webID)E|e)xportedVar|g(?:r(?:antSessionRule|oup)|lobalStorageOption)|n(?:otificationStorageOption|ginxCustomHandler)|c(?:as(?:StorageOption|Attribute)|ombModule)|p(?:ersistentStorageOption|ortalSkinRule)|re(?:moteGlobalStorageOption|loadUrl)|CAS_proxiedService|macro)s|
s(?:(?:amlStorageOption|laveExportedVar|TokenScope)s|essionDataToRemember)|o(?:idcS(?:erviceMetaDataAuthnContext|torageOptions)|penIdExportedVars
)|a(?:uthChoiceModules|pplicationList)|SSLVarIf)
';
our
$simpleHashKeys
=
'
(?:(?:l(?:o(?:calSessionStorageOption|goutService)|dapExportedVar|wp(?:Ssl)?Opt)|(?:(?:d(?:emo|bi)|facebook|webID)E|e)xportedVar|g(?:r(?:antSessionRule|oup)|lobalStorageOption)|n(?:otificationStorageOption|ginxCustomHandler)|c(?:as(?:StorageOption|Attribute)|ombModule)|p(?:ersistentStorageOption|ortalSkinRule)|re(?:moteGlobalStorageOption|loadUrl)|CAS_proxiedService|macro)s|
o(?:idcS(?:erviceMetaDataAuthnContext|torageOptions)|penIdExportedVars)|s(?:(?:amlStorageOption|laveExportedVar)s|essionDataToRemember
)|a(?:uthChoiceModules|pplicationList)|SSLVarIf)
';
our
$specialNodeKeys
=
'
(?:(?:saml(?:ID|S)|oidc[OR])PMetaDataNode|virtualHost)s
';
our
$oidcOPMetaDataNodeKeys
=
'
oidcOPMetaData(?:Options(?:C(?:lient(?:Secret|ID)|heckJWTSignature|onfigurationURI)|TokenEndpointAuthMethod|(?:JWKSTimeou|Promp)t|I(?:DTokenMaxAge|con)|S(?:toreIDToken|cope)|U(?:iLocales|seNonce)|Display(?:Name)?|AcrValues|MaxAge)|ExportedVars|J(?:SON|WKS))
';
our
$oidcRPMetaDataNodeKeys
=
'
oidcRPMetaData(?:Options(?:I(?:DToken(?:Expiration|SignAlg)|con)|(?:RedirectUri|ExtraClaim)s|AccessTokenExpiration|Client(?:Secret|ID)|BypassConsent|DisplayName|UserIDAttr)|ExportedVars)
';
...
...
lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Lib/ServiceToken.pm
View file @
96263e0e
...
...
@@ -5,17 +5,17 @@ use strict;
our
$VERSION
=
'
2.0.0
';
sub
fetchId
{
my
(
$class
)
=
@_
;
my
(
$class
)
=
@_
;
my
$token
=
$class
->
header_in
('
X-Llng-Token
');
return
$class
->
Lemonldap::NG::Handler::Main::
fetchId
()
unless
(
$token
);
return
$class
->
Lemonldap::NG::Handler::Main::
fetchId
()
unless
(
$token
);
$class
->
logger
->
debug
('
Found token header
');
my
$s
$class
->
tsv
->
{
cipher
}
->
decrypt
(
$s
);
my
(
$t
,
$_session_id
,
@vhosts
)
=
split
/:/
,
$s
;
unless
(
@vhosts
)
{
my
$s
=
$class
->
tsv
->
{
cipher
}
->
decrypt
(
$token
);
my
(
$t
,
$_session_id
,
@vhosts
)
=
split
/:/
,
$s
;
unless
(
@vhosts
)
{
$class
->
userLogger
->
error
('
Bad token
');
return
0
;
}
unless
(
$t
<=
time
and
$t
>
time
-
15
)
{
unless
(
$t
<=
time
and
$t
>
time
-
15
)
{
$class
->
userLogger
->
warn
('
Expired token
');
return
0
;
}
...
...
lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Main/Reload.pm
View file @
96263e0e
...
...
@@ -338,7 +338,7 @@ sub headersInit {
$headers
||=
$conf
->
{
exportedHeaders
};
# Creation of the subroutine which will generate headers
foreach
my
$vhost
(
keys
%
{
$headers
}
)
{
foreach
my
$vhost
(
keys
%
{
$headers
}
)
{
my
%headers
=
%
{
$headers
->
{
$vhost
}
};
$class
->
tsv
->
{
headerList
}
->
{
$vhost
}
=
[
keys
%headers
];
my
$sub
=
'';
...
...
lemonldap-ng-handler/t/64-Lemonldap-NG-Handler-PSGI-DevOps.t
View file @
96263e0e
...
...
@@ -13,24 +13,48 @@ init('Lemonldap::NG::Handler::Server');
my
$res
;
# Authorizated queries
ok
(
$res
=
$client
->
_get
(
'
/
',
undef
,
'
test3.example.com
',
"
lemonldap=
$sessionId
",
VHOSTTYPE
=>
'
DevOps
'
),
'
Authorizated query
'
);
ok
(
$res
=
$client
->
_get
(
'
/
',
undef
,
'
test3.example.com
',
"
lemonldap=
$sessionId
",
VHOSTTYPE
=>
'
DevOps
'
),
'
Authorizated query
'
);
ok
(
$res
->
[
0
]
==
200
,
'
Code is 200
'
)
or
explain
(
$res
->
[
0
],
200
);
count
(
2
);
ok
(
$res
=
$client
->
_get
(
'
/testyes
',
undef
,
'
test3.example.com
',
"
lemonldap=
$sessionId
",
VHOSTTYPE
=>
'
DevOps
'
),
'
Authorizated query
'
);
ok
(
$res
=
$client
->
_get
(
'
/testyes
',
undef
,
'
test3.example.com
',
"
lemonldap=
$sessionId
",
VHOSTTYPE
=>
'
DevOps
'
),
'
Authorizated query
'
);
ok
(
$res
->
[
0
]
==
200
,
'
Code is 200
'
)
or
explain
(
$res
->
[
0
],
200
);
count
(
2
);
# Denied queries
ok
(
$res
=
$client
->
_get
(
'
/deny
',
undef
,
'
test3.example.com
',
"
lemonldap=
$sessionId
",
VHOSTTYPE
=>
'
DevOps
'
),
'
Denied query
'
);
ok
(
$res
=
$client
->
_get
(
'
/deny
',
undef
,
'
test3.example.com
',
"
lemonldap=
$sessionId
",
VHOSTTYPE
=>
'
DevOps
'
),
'
Denied query
'
);
ok
(
$res
->
[
0
]
==
403
,
'
Code is 403
'
)
or
explain
(
$res
->
[
0
],
403
);
count
(
2
);
ok
(
$res
=
$client
->
_get
(
'
/testno
',
undef
,
'
test3.example.com
',
"
lemonldap=
$sessionId
",
VHOSTTYPE
=>
'
DevOps
'
),
'
Denied query
'
);
ok
(
$res
=
$client
->
_get
(
'
/testno
',
undef
,
'
test3.example.com
',
"
lemonldap=
$sessionId
",
VHOSTTYPE
=>
'
DevOps
'
),
'
Denied query
'
);
ok
(
$res
->
[
0
]
==
403
,
'
Code is 403
'
)
or
explain
(
$res
->
[
0
],
403
);
count
(
2
);
...
...
@@ -56,7 +80,7 @@ sub LWP::UserAgent::request {
}
}
';
$httpResp
=
HTTP::
Response
->
new
(
200
,
'
OK
'
);
$httpResp
->
header
(
'
Content-Type
',
'
application/json
'
);
$httpResp
->
header
(
'
Content-Type
',
'
application/json
'
);
$httpResp
->
header
(
'
Content-Length
',
length
(
$s
)
);
$httpResp
->
content
(
$s
);
return
$httpResp
;
...
...
lemonldap-ng-manager/lib/Lemonldap/NG/Manager.pm
View file @
96263e0e
...
...
@@ -34,7 +34,7 @@ sub init {
if
(
my
$localconf
=
$self
->
confAcc
->
getLocalConf
(
MANAGERSECTION
)
)
{
foreach
(
keys
%$localconf
)
{
$args
->
{
$_
}
//
=
$localconf
->
{
$_
};
$self
->
{
$_
}
=
$args
->
{
$_
}
unless
(
/^(?:l|userL)ogger$/
);
$self
->
{
$_
}
=
$args
->
{
$_
}
unless
(
/^(?:l|userL)ogger$/
);
}
}
...
...
lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Attributes.pm
View file @
96263e0e
...
...
@@ -2784,13 +2784,6 @@ qr/^(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-
'
staticPrefix
'
=>
{
'
type
'
=>
'
text
'
},
'
sTokenScopes
'
=>
{
'
type
'
=>
'
keyTextContainer
'
},
'
sTokenService
'
=>
{
'
default
'
=>
0
,
'
type
'
=>
'
bool
'
},
'
storePassword
'
=>
{
'
default
'
=>
0
,
'
type
'
=>
'
bool
'
...
...
lemonldap-ng-manager/site/htdocs/static/reverseTree.json
View file @
96263e0e
This diff is collapsed.
Click to expand it.
lemonldap-ng-manager/site/htdocs/static/struct.json
View file @
96263e0e
This diff is collapsed.
Click to expand it.
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/SAML.pm
View file @
96263e0e
...
...
@@ -989,7 +989,7 @@ sub extractFormInfo {
$infos
->
{
Artifact
}
=
$req
->
datas
->
{
_proxiedArtifact
};
$infos
->
{
ProxyID
}
=
$samlID
;
my
$samlSessionInfo
=
$self
->
getSamlSession
(
undef
,
$infos
);
my
$samlSessionInfo
=
$self
->
getSamlSession
(
undef
,
$infos
);
return
PE_SAML_SESSION_ERROR
unless
$samlSessionInfo
;
...
...
@@ -1180,7 +1180,6 @@ sub authFinish {
.
$nameid
->
dump
.
"
and SessionIndex
$session_index
for session
$id
"
);
my
$infos
;
$infos
->
{
type
}
=
'
saml
';
# Session type
$infos
->
{
_utime
}
=
$utime
;
# Creation time
...
...
@@ -1189,7 +1188,7 @@ sub authFinish {
$infos
->
{
_sessionIndex
}
=
$session_index
;
# SAML SessionIndex
# Save SAML session
my
$samlSessionInfo
=
$self
->
getSamlSession
(
undef
,
$infos
);
my
$samlSessionInfo
=
$self
->
getSamlSession
(
undef
,
$infos
);
return
PE_SAML_SESSION_ERROR
unless
$samlSessionInfo
;
...
...
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Issuer/OpenIDConnect.pm
View file @
96263e0e
...
...
@@ -505,7 +505,8 @@ qq'<h3 trspan="oidcConsent,$display_name">The application $display_name would li
if
(
$flow
eq
"
authorizationcode
"
)
{
# Store data in session
my
$codeSession
=
$self
->
getOpenIDConnectSession
(
undef
,
my
$codeSession
=
$self
->
getOpenIDConnectSession
(
undef
,
{
redirect_uri
=>
$oidc_request
->
{'
redirect_uri
'},
scope
=>
$oidc_request
->
{'
scope
'},
...
...
@@ -516,7 +517,7 @@ qq'<h3 trspan="oidcConsent,$display_name">The application $display_name would li
);
# Generate code
my
$code
=
$codeSession
->
id
();
my
$code
=
$codeSession
->
id
();
$self
->
logger
->
debug
("
Generated code:
$code
");
...
...
@@ -543,7 +544,8 @@ qq'<h3 trspan="oidcConsent,$display_name">The application $display_name would li
# Store data in access token
# Generate access_token
my
$accessTokenSession
=
$self
->
getOpenIDConnectSession
(
undef
,
my
$accessTokenSession
=
$self
->
getOpenIDConnectSession
(
undef
,
{
scope
=>
$oidc_request
->
{'
scope
'},
rp
=>
$rp
,
...
...
@@ -654,7 +656,8 @@ qq'<h3 trspan="oidcConsent,$display_name">The application $display_name would li
my
(
$hash_level
)
=
(
$alg
=~
/(?:\w{2})(\d{3})/
);
# Store data in session
my
$codeSession
=
$self
->
getOpenIDConnectSession
(
undef
,
my
$codeSession
=
$self
->
getOpenIDConnectSession
(
undef
,
{
redirect_uri
=>
$oidc_request
->
{'
redirect_uri
'},
scope
=>
$oidc_request
->
{'
scope
'},
...
...
@@ -665,7 +668,7 @@ qq'<h3 trspan="oidcConsent,$display_name">The application $display_name would li
);
# Generate code
my
$code
=
$codeSession
->
id
();
my
$code
=
$codeSession
->
id
();
$self
->
logger
->
debug
("
Generated code:
$code
");
...
...
@@ -675,7 +678,8 @@ qq'<h3 trspan="oidcConsent,$display_name">The application $display_name would li
if
(
$response_type
=~
/\btoken\b/
)
{
# Generate access_token
my
$accessTokenSession
=
$self
->
getOpenIDConnectSession
(
undef
,
my
$accessTokenSession
=
$self
->
getOpenIDConnectSession
(
undef
,
{
scope
=>
$oidc_request
->
{'
scope
'},
rp
=>
$rp
,
...
...
@@ -895,7 +899,8 @@ sub token {
$self
->
logger
->
debug
("
Found corresponding user:
$user_id
");
# Generate access_token
my
$accessTokenSession
=
$self
->
getOpenIDConnectSession
(
undef
,
my
$accessTokenSession
=
$self
->
getOpenIDConnectSession
(
undef
,
{
scope
=>
$codeSession
->
data
->
{
scope
},
rp
=>
$rp
,
...
...
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/Notifications/XML.pm
View file @
96263e0e
...
...
@@ -251,7 +251,7 @@ has server => ( is => 'rw' );
sub
notificationServer
{
my
(
$self
,
$req
)
=
@_
;
unless
(
$self
->
imported
)
{
unless
(
$self
->
imported
)
{
eval
{
require
Lemonldap::NG::Common::PSGI::
SOAPServer
;
require
Lemonldap::NG::Common::PSGI::
SOAPService
;
...
...
@@ -259,9 +259,7 @@ sub notificationServer {
if
(
$@
)
{
return
$self
->
p
->
sendError
(
$req
,
$@
,
500
);
}
$self
->
server
(
Lemonldap::NG::Common::PSGI::
SOAPServer
->
new
);
$self
->
server
(
Lemonldap::NG::Common::PSGI::
SOAPServer
->
new
);
$self
->
imported
(
1
);
}
unless
(
$req
->
env
->
{
HTTP_SOAPACTION
}
)
{
...
...
@@ -275,7 +273,7 @@ sub notificationServer {
}
sub
newNotification
{
my
(
$self
,
$req
,
$xml
)
=
@_
;
my
(
$self
,
$req
,
$xml
)
=
@_
;
return
$self
->
notifObject
->
newNotification
(
$xml
);
}
...
...
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/OpenIDConnect.pm
View file @
96263e0e
...
...
@@ -258,7 +258,8 @@ sub buildAuthorizationCodeAuthnRequest {
my
$nonce
;
if
(
$use_nonce
)
{
my
$nonceSession
=
$self
->
getOpenIDConnectSession
(
undef
,
{
'
_utime
'
=>
time
});
my
$nonceSession
=
$self
->
getOpenIDConnectSession
(
undef
,
{
'
_utime
'
=>
time
}
);
$nonce
=
$nonceSession
->
id
;
}
...
...
@@ -640,7 +641,7 @@ sub getOpenIDConnectSession {
cacheModuleOptions
=>
$self
->
conf
->
{
localSessionStorageOptions
},
id
=>
$id
,
kind
=>
"
OpenIDConnect
",
(
$info
?
(
info
=>
$info
):()
),
(
$info
?
(
info
=>
$info
)
:
()
),
}
);
...
...
@@ -673,7 +674,6 @@ sub storeState {
}
return
unless
(
$infos
);
# Session type
$infos
->
{
_type
}
=
"
state
";
...
...
@@ -686,7 +686,7 @@ sub storeState {
$infos
->
{
_utime
}
=
$time
+
(
$stateTimeout
-
$timeout
);
# Create state session and store infos
my
$stateSession
=
$self
->
getOpenIDConnectSession
(
undef
,
$infos
);
my
$stateSession
=
$self
->
getOpenIDConnectSession
(
undef
,
$infos
);
return
unless
$stateSession
;
# Return session ID
...
...
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/REST.pm
View file @
96263e0e
...
...
@@ -15,16 +15,16 @@ has ua => (
);
sub
restCall
{
my
(
$self
,
$url
,
$content
)
=
@_
;
my
(
$self
,
$url
,
$content
)
=
@_
;
my
$hreq
=
HTTP::
Request
->
new
(
POST
=>
$url
);
$hreq
->
header
(
'
Content-Type
'
=>
'
application/json
'
);
$hreq
->
content
(
to_json
(
$content
)
);
$hreq
->
content
(
to_json
(
$content
)
);
my
$resp
=
$self
->
ua
->
request
(
$hreq
);
unless
(
$resp
->
is_success
)
{
die
$resp
->
status_line
;
}
my
$res
=
eval
{
from_json
(
$resp
->
content
)
};
die
"
Bad REST response: $@
"
if
(
$@
);
die
"
Bad REST response: $@
"
if
(
$@
);
return
$res
;
}
...
...
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/SAML.pm
View file @
96263e0e
...
...
@@ -1780,7 +1780,7 @@ sub createArtifactResponse {
# Load artifact message into login response
my
$art_session
=
$self
->
loadArtifact
(
$artifact_id
);
utf8::
decode
(
$art_session
->
{
message
}
);
utf8::
decode
(
$art_session
->
{
message
}
);
eval
{
$login
->
set_artifact_message
(
$art_session
->
{
message
}
);
};
if
(
$@
)
{
$self
->
checkLassoError
(
$@
);
...
...
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm
View file @
96263e0e
...
...
@@ -90,7 +90,7 @@ sub display {
&&
$req
->
datas
->
{
login
},
ASK_LOGINS
=>
$req
->
param
('
checkLogins
')
||
0
,
CONFIRMKEY
=>
$self
->
stamp
(),
LIST
=>
$req
->
datas
->
{
list
}
||
[]
,
LIST
=>
$req
->
datas
->
{
list
}
||
[]
,
REMEMBER
=>
$req
->
datas
->
{
confirmRemember
},
);
}
...
...
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Password/LDAP.pm
View file @
96263e0e
...
...
@@ -25,8 +25,8 @@ sub modifyPassword {
my
(
$self
,
$req
,
$pwd
)
=
@_
;
# Call the modify password method
my
$code
=
$self
->
ldap
->
userModifyPassword
(
$req
->
userData
->
{
dn
},
$pwd
,
$req
->
datas
->
{
oldpassword
}
);
my
$code
=
$self
->
ldap
->
userModifyPassword
(
$req
->
userData
->
{
dn
},
$pwd
,
$req
->
datas
->
{
oldpassword
}
);
unless
(
$code
==
PE_PASSWORD_OK
)
{
$self
->
ldap
->
unbind
;
...
...
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Password/REST.pm
View file @
96263e0e
...
...
@@ -26,8 +26,10 @@ sub init {
sub
confirm
{
my
(
$self
,
$req
,
$pwd
)
=
@_
;
my
$res
=
eval
{
$self
->
restCall
(
$self
->
conf
->
{
restPwdConfirmUrl
},
{
user
=>
$req
->
user
,
password
=>
$pwd
}
);
$self
->
restCall
(
$self
->
conf
->
{
restPwdConfirmUrl
},
{
user
=>
$req
->
user
,
password
=>
$pwd
}
);
};
if
(
$@
)
{
$self
->
logger
("
Pwd confirm error: $@
");
...
...
@@ -39,8 +41,10 @@ sub confirm {
sub
modifyPassword
{
my
(
$self
,
$req
,
$pwd
)
=
@_
;
my
$res
=
eval
{
$self
->
restCall
(
$self
->
conf
->
{
restPwdModifyUrl
},
{
user
=>
$req
->
user
,
password
=>
$pwd
}
);
$self
->
restCall
(
$self
->
conf
->
{
restPwdModifyUrl
},
{
user
=>
$req
->
user
,
password
=>
$pwd
}
);
};
if
(
$@
)
{
$self
->
logger
("
Pwd confirm error: $@
");
...
...
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/SOAPServer.pm
View file @
96263e0e
...
...
@@ -246,7 +246,7 @@ sub setAttributes {
my
$infos
=
{};
%$infos
=
%$args
;
my
$session
=
$self
->
p
->
getApacheSession
(
$id
,
info
=>
$infos
);
my
$session
=
$self
->
p
->
getApacheSession
(
$id
,
info
=>
$infos
);
unless
(
$session
)
{
$self
->
logger
->
warn
("
Session
$id
does not exists ($@)
");
...
...
@@ -288,7 +288,7 @@ sub newSession {
%$infos
=
%$args
;
$infos
->
{
_utime
}
=
time
();
my
$session
=
$self
->
p
->
getApacheSession
(
undef
,
info
=>
$infos
);
my
$session
=
$self
->
p
->
getApacheSession
(
undef
,
info
=>
$infos
);
unless
(
$session
)
{
$self
->
logger
->
error
("
Unable to create session
");
...
...
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Register/Demo.pm
View file @
96263e0e
...
...
@@ -32,13 +32,13 @@ sub computeLogin {
# @result Lemonldap::NG::Portal constant
sub
createUser
{
my
(
$self
,
$req
)
=
@_
;
$
Lemonldap::NG::Portal::UserDB::Demo::
demoAccounts
{
$req
->
datas
->
{
registerInfo
}
->
{
login
}
}
=
{
$
Lemonldap::NG::Portal::UserDB::Demo::
demoAccounts
{
$req
->
datas
->
{
registerInfo
}
->
{
login
}
}
=
{
uid
=>
$req
->
datas
->
{
registerInfo
}
->
{
login
},
cn
=>
$req
->
datas
->
{
registerInfo
}
->
{
firstname
}
.
'
'
.
$req
->
datas
->
{
registerInfo
}
->
{
lastname
},
mail
=>
$req
->
datas
->
{
registerInfo
}
->
{
login
}
.
'
@badwolf.org
',
};
};
return
PE_OK
;
}
...
...
lemonldap-ng-portal/t/21-Auth-and-password-LDAP.t
View file @
96263e0e
...
...
@@ -14,17 +14,17 @@ SKIP: {
my
$client
=
LLNG::Manager::
Test
->
new
(
{
ini
=>
{
logLevel
=>
'
error
',
useSafeJail
=>
1
,
authentication
=>
'
LDAP
',
portal
=>
'
http://auth.example.com/
',
userDB
=>
'
Same
',
passwordDB
=>
'
LDAP
',
logLevel
=>
'
error
',
useSafeJail
=>
1
,
authentication
=>
'
LDAP
',
portal
=>
'
http://auth.example.com/
',
userDB
=>
'
Same
',
passwordDB
=>
'
LDAP
',
portalRequireOldPassword
=>
1
,
ldapServer
=>
'
ldap://127.0.0.1:19389/
',
ldapBase
=>
'
ou=users,dc=example,dc=com
',
managerDn
=>
'
cn=admin,dc=example,dc=com
',
managerPassword
=>
'
admin
',
ldapServer
=>
'
ldap://127.0.0.1:19389/
',
ldapBase
=>
'
ou=users,dc=example,dc=com
',
managerDn
=>
'
cn=admin,dc=example,dc=com
',
managerPassword
=>
'
admin
',
}
}
);
...
...
lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Artifact-with-SOAP-SLO-IdP-initiated.t
View file @
96263e0e
...
...
@@ -30,8 +30,7 @@ SKIP: {
switch
('
issuer
');
ok
(
$res
=
$issuer
->
_post
(
'
/
',
IO::
String
->
new
('
user=russian&password=russian
'),
'
/
',
IO::
String
->
new
('
user=russian&password=russian
'),
length
=>
29
),
'
Auth query
'
...
...
@@ -495,7 +494,7 @@ sub sp {
samlIDPMetaDataOptionsSignSLOMessage
=>
1
,
samlIDPMetaDataOptionsCheckSSOMessageSignature
=>
1
,
samlIDPMetaDataOptionsCheckSLOMessageSignature
=>
1
,
samlIDPMetaDataOptionsForceUTF8
=>
1
,
samlIDPMetaDataOptionsForceUTF8
=>
1
,
samlIDPMetaDataOptionsAllowLoginFromIDP
=>
1
,
}
},
...
...
lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Artifact-with-SOAP-SLO.t
View file @
96263e0e
...
...
@@ -544,7 +544,7 @@ sub sp {
samlIDPMetaDataOptionsSignSLOMessage
=>
1
,
samlIDPMetaDataOptionsCheckSSOMessageSignature
=>
1
,
samlIDPMetaDataOptionsCheckSLOMessageSignature
=>
1
,
samlIDPMetaDataOptionsForceUTF8
=>
1
,
samlIDPMetaDataOptionsForceUTF8
=>
1
,
}
},
samlIDPMetaDataExportedAttributes
=>
{
...
...
lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-POST-IdP-initiated.t
View file @
96263e0e
...
...
@@ -30,8 +30,7 @@ SKIP: {
switch
('
issuer
');
ok
(
$res
=
$issuer
->
_post
(
'
/
',
IO::
String
->
new
('
user=russian&password=russian
'),
'
/
',
IO::
String
->
new
('
user=russian&password=russian
'),
length
=>
29
),
'
Auth query
'
...
...
@@ -523,7 +522,7 @@ sub sp {
samlIDPMetaDataOptionsSignSLOMessage
=>
1
,
samlIDPMetaDataOptionsCheckSSOMessageSignature
=>
1
,
samlIDPMetaDataOptionsCheckSLOMessageSignature
=>
1
,
samlIDPMetaDataOptionsForceUTF8
=>
1
,
samlIDPMetaDataOptionsForceUTF8
=>
1
,
samlIDPMetaDataOptionsAllowLoginFromIDP
=>
1
,
}
},
...
...
lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-POST.t
View file @
96263e0e
...
...
@@ -539,7 +539,7 @@ sub sp {
samlIDPMetaDataOptionsSignSLOMessage
=>
1
,
samlIDPMetaDataOptionsCheckSSOMessageSignature
=>
1
,
samlIDPMetaDataOptionsCheckSLOMessageSignature
=>
1
,
samlIDPMetaDataOptionsForceUTF8
=>
1
,
samlIDPMetaDataOptionsForceUTF8
=>
1
,
}
},
samlIDPMetaDataExportedAttributes
=>
{
...
...
lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Redirect-IdP-initiated.t
View file @
96263e0e
...
...
@@ -30,8 +30,7 @@ SKIP: {
switch
('
issuer
');
ok
(
$res
=
$issuer
->
_post
(
'
/
',
IO::
String
->
new
('
user=russian&password=russian
'),
'
/
',
IO::
String
->
new
('
user=russian&password=russian
'),
length
=>
29
),
'
Auth query
'
...
...
@@ -506,7 +505,7 @@ sub sp {
samlIDPMetaDataOptionsSignSLOMessage
=>
1
,
samlIDPMetaDataOptionsCheckSSOMessageSignature
=>
1
,
samlIDPMetaDataOptionsCheckSLOMessageSignature
=>
1
,
samlIDPMetaDataOptionsForceUTF8
=>
1
,
samlIDPMetaDataOptionsForceUTF8
=>
1
,
samlIDPMetaDataOptionsAllowLoginFromIDP
=>
1
,
}
},
...
...
lemonldap-ng-portal/t/30-Auth-and-issuer-SAML-Redirect.t
View file @
96263e0e
...
...
@@ -556,7 +556,7 @@ sub sp {
samlIDPMetaDataOptionsSignSLOMessage
=>
1
,
samlIDPMetaDataOptionsCheckSSOMessageSignature
=>
1
,
samlIDPMetaDataOptionsCheckSLOMessageSignature
=>
1
,
samlIDPMetaDataOptionsForceUTF8
=>
1
,
samlIDPMetaDataOptionsForceUTF8
=>
1
,
}
},
samlIDPMetaDataExportedAttributes
=>
{
...
...
lemonldap-ng-portal/t/32-Auth-and-issuer-OIDC-authorization_code.t
View file @
96263e0e
...
...
@@ -241,6 +241,7 @@ sub LWP::UserAgent::request {
while
(
my
$name
=
shift
@
{
$res
->
[
1
]
}
)
{
$httpResp
->
header
(
$name
,
shift
(
@
{
$res
->
[
1
]
}
)
);
}
#print STDERR Dumper($res->[2]);
$httpResp
->
content
(
join
(
'',
@
{
$res
->
[
2
]
}
)
);
count
(
4
);
...
...
lemonldap-ng-portal/t/40-Notifications-XML-Server.t
View file @
96263e0e
...
...
@@ -48,7 +48,8 @@ SKIP: {
'
SOAP client
'
);
$soap
->
default_ns
('
urn:Lemonldap/NG/Common/PSGI/SOAPService
');
ok
(
$soap
->
call
(
'
newNotification
',
$xml
)
->
result
()
==
1
,
'
SOAP call returns 1
'
);
ok
(
$soap
->
call
(
'
newNotification
',
$xml
)
->
result
()
==
1
,
'
SOAP call returns 1
'
);
# Try yo authenticate
# -------------------
...
...
lemonldap-ng-portal/t/test-ldap.pm
View file @
96263e0e
# Try to launch an LDAP server
if
(
$ENV
{
LLNGTESTLDAP
}
)
{
my
$slapd_bin
=
$ENV
{
LLNGTESTLDAP_SLAPD_BIN
}
||
'
/usr/sbin/slapd
';
if
(
$ENV
{
LLNGTESTLDAP
}
)
{
my
$slapd_bin
=
$ENV
{
LLNGTESTLDAP_SLAPD_BIN
}
||
'
/usr/sbin/slapd
';
my
$slapadd_bin
=
$ENV
{
LLNGTESTLDAP_SLAPADD_BIN
}
||
'
/usr/sbin/slapadd
';
my
$slapd_schema_dir
=
$ENV
{
LLNGTESTLDAP_SCHEMA_DIR
}
||
'
/etc/slapd/schema
';
eval
{
mkdir
'
t/testslapd/slapd.d
'
};
eval
{
mkdir
'
t/testslapd/data
'
};
system
('
cp t/testslapd/slapd.ldif t/testslapd/slapd-test.ldif
');
system
("
/bin/sed -i 's:__SCHEMA_DIR__:
$slapd_schema_dir
:' t/testslapd/slapd-test.ldif
");
system
(
$slapadd_bin
.
'
-F t/testslapd/slapd.d -n 0 -l t/testslapd/slapd-test.ldif
');
system
(
$slapadd_bin
.
'
-F t/testslapd/slapd.d -n 1 -l t/testslapd/users.ldif
');