Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
A
auth
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lib
unicaen
auth
Commits
c9f7265e
Commit
c9f7265e
authored
Apr 23, 2019
by
Bertrand Gauthier
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release-1.3.8'
parents
c8467a2a
fa40379e
Pipeline
#4327
passed with stage
in 19 seconds
Changes
3
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
5 deletions
+63
-5
config/unicaen-auth.global.php.dist
config/unicaen-auth.global.php.dist
+16
-0
src/UnicaenAuth/Options/ModuleOptionsFactory.php
src/UnicaenAuth/Options/ModuleOptionsFactory.php
+39
-0
src/UnicaenAuth/Service/ShibService.php
src/UnicaenAuth/Service/ShibService.php
+8
-5
No files found.
config/unicaen-auth.global.php.dist
View file @
c9f7265e
...
...
@@ -28,6 +28,22 @@ $settings = [
'enabled'
=>
true
,
],
/**
* Configuration de l'authentification Shibboleth.
*/
'shibboleth'
=>
[
/**
* Affichage ou non du formulaire d'authentification via l'annuaire LDAP.
* NB: en réalité cela permet aussi l'authentification avec un compte local.
*/
'enable'
=>
false
,
/**
* URL de déconnexion.
*/
'logout_url'
=>
'/Shibboleth.sso/Logout?return='
,
// NB: '?return=' semble obligatoire!
],
/**
* Flag indiquant si l'utilisateur authenitifié avec succès via l'annuaire LDAP doit
* être enregistré/mis à jour dans la table des utilisateurs de l'appli.
...
...
src/UnicaenAuth/Options/ModuleOptionsFactory.php
View file @
c9f7265e
...
...
@@ -2,6 +2,9 @@
namespace
UnicaenAuth\Options
;
use
Assert\Assertion
;
use
Assert\AssertionFailedException
;
use
UnicaenApp\Exception\RuntimeException
;
use
Zend\ServiceManager\FactoryInterface
;
use
Zend\ServiceManager\ServiceLocatorInterface
;
...
...
@@ -24,6 +27,42 @@ class ModuleOptionsFactory implements FactoryInterface
$moduleConfig
=
isset
(
$config
[
'unicaen-auth'
])
?
$config
[
'unicaen-auth'
]
:
[];
$moduleConfig
=
array_merge
(
$config
[
'zfcuser'
],
$moduleConfig
);
$this
->
validateConfig
(
$moduleConfig
);
return
new
ModuleOptions
(
$moduleConfig
);
}
/**
* @param array $config
*/
private
function
validateConfig
(
array
$config
)
{
$configKeyPath
=
[
'unicaen-auth'
];
//
// Config shibboleth.
//
$parentKey
=
'shibboleth'
;
if
(
array_key_exists
(
$parentKey
,
$config
))
{
$shibConfig
=
$config
[
$parentKey
];
$configKeyPath
[]
=
$parentKey
;
try
{
Assertion
::
keyExists
(
$shibConfig
,
$k
=
'logout_url'
);
}
catch
(
AssertionFailedException
$e
)
{
throw
new
RuntimeException
(
sprintf
(
"La clé de configuration '%s.
$k
' est absente (inspirez-vous du fichier de config "
.
"unicaen-auth.global.php.dist du module unicaen/auth si besoin)"
,
join
(
'.'
,
$configKeyPath
)
));
}
array_pop
(
$configKeyPath
);
}
//
// Autres.
//
}
}
\ No newline at end of file
src/UnicaenAuth/Service/ShibService.php
View file @
c9f7265e
...
...
@@ -100,7 +100,10 @@ EOS;
*/
private
function
isAuthenticated
()
{
return
(
bool
)
$this
->
getServerArrayVariable
(
'REMOTE_USER'
);
return
$this
->
getServerArrayVariable
(
'REMOTE_USER'
)
||
$this
->
getServerArrayVariable
(
'Shib-Session-ID'
)
||
$this
->
getServerArrayVariable
(
'HTTP_SHIB_SESSION_ID'
);
}
/**
...
...
@@ -363,7 +366,7 @@ EOS;
*/
public
function
simulateAuthenticatedUser
(
ShibUser
$shibUser
,
$keyForId
=
'supannEmpId'
)
{
// 'REMOTE_USER' est utilisé pour savoir si un utilisateur est authentifié ou non
// 'REMOTE_USER'
(notamment)
est utilisé pour savoir si un utilisateur est authentifié ou non
$this
->
setServerArrayVariable
(
'REMOTE_USER'
,
$shibUser
->
getEppn
());
// // on s'assure que tous les attributs obligatoires ont une valeur
...
...
@@ -434,13 +437,13 @@ EOS;
return
'/'
;
}
$logout
RelativeUrl
=
'/Shibboleth.sso/Logout?return='
;
// NB: '?return=' semble obligatoire!
$logout
Url
=
$this
->
shibbolethConfig
[
'logout_url'
];
if
(
$returnAbsoluteUrl
)
{
$logout
Relative
Url
.
=
urlencode
(
$returnAbsoluteUrl
);
$logoutUrl
.
=
urlencode
(
$returnAbsoluteUrl
);
}
return
$logout
Relative
Url
;
return
$logoutUrl
;
}
/**
...
...
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