Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplesamlphp
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Perun
Perun ProxyIdP
v1
simplesamlphp
Commits
c90d80ca
Unverified
Commit
c90d80ca
authored
6 years ago
by
Jaime Pérez Crespo
Browse files
Options
Downloads
Patches
Plain Diff
Start using the authentication factory.
parent
56c6228a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/SimpleSAML/ModuleControllerResolver.php
+2
-0
2 additions, 0 deletions
lib/SimpleSAML/ModuleControllerResolver.php
modules/core/lib/Controller.php
+16
-8
16 additions, 8 deletions
modules/core/lib/Controller.php
with
18 additions
and
8 deletions
lib/SimpleSAML/ModuleControllerResolver.php
+
2
−
0
View file @
c90d80ca
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
namespace
SimpleSAML
;
namespace
SimpleSAML
;
use
SimpleSAML\Auth\AuthenticationFactory
;
use
SimpleSAML\Error\Exception
;
use
SimpleSAML\Error\Exception
;
use
Symfony\Component\Config\Exception\FileLocatorFileNotFoundException
;
use
Symfony\Component\Config\Exception\FileLocatorFileNotFoundException
;
use
Symfony\Component\Config\FileLocator
;
use
Symfony\Component\Config\FileLocator
;
...
@@ -60,6 +61,7 @@ class ModuleControllerResolver extends ControllerResolver implements ArgumentRes
...
@@ -60,6 +61,7 @@ class ModuleControllerResolver extends ControllerResolver implements ArgumentRes
$this
->
argFactory
=
new
ArgumentMetadataFactory
();
$this
->
argFactory
=
new
ArgumentMetadataFactory
();
$this
->
container
=
new
ContainerBuilder
();
$this
->
container
=
new
ContainerBuilder
();
$this
->
container
->
autowire
(
AuthenticationFactory
::
class
,
AuthenticationFactory
::
class
);
try
{
try
{
$this
->
routes
=
$loader
->
load
(
'routes.yaml'
);
$this
->
routes
=
$loader
->
load
(
'routes.yaml'
);
...
...
This diff is collapsed.
Click to expand it.
modules/core/lib/Controller.php
+
16
−
8
View file @
c90d80ca
...
@@ -21,6 +21,9 @@ class Controller
...
@@ -21,6 +21,9 @@ class Controller
/** @var \SimpleSAML\Configuration */
/** @var \SimpleSAML\Configuration */
protected
$config
;
protected
$config
;
/** @var \SimpleSAML\Auth\AuthenticationFactory */
protected
$factory
;
/** @var \SimpleSAML\Session */
/** @var \SimpleSAML\Session */
protected
$session
;
protected
$session
;
...
@@ -33,14 +36,19 @@ class Controller
...
@@ -33,14 +36,19 @@ class Controller
*
*
* It initializes the global configuration and auth source configuration for the controllers implemented here.
* It initializes the global configuration and auth source configuration for the controllers implemented here.
*
*
* @param \SimpleSAML\Configuration $config The configuration to use by the controllers.
* @param \SimpleSAML\Configuration $config The configuration to use by the controllers.
* @param \SimpleSAML\Session $session The session to use by the controllers.
* @param \SimpleSAML\Session $session The session to use by the controllers.
* @param \SimpleSAML\Auth\AuthenticationFactory $factory A factory to instantiate \SimpleSAML\Auth\Simple objects.
*
*
* @throws \Exception
* @throws \Exception
*/
*/
public
function
__construct
(
\SimpleSAML\Configuration
$config
,
\SimpleSAML\Session
$session
)
public
function
__construct
(
{
\SimpleSAML\Configuration
$config
,
\SimpleSAML\Session
$session
,
\SimpleSAML\Auth\AuthenticationFactory
$factory
)
{
$this
->
config
=
$config
;
$this
->
config
=
$config
;
$this
->
factory
=
$factory
;
$this
->
sources
=
$config
::
getOptionalConfig
(
'authsources.php'
)
->
toArray
();
$this
->
sources
=
$config
::
getOptionalConfig
(
'authsources.php'
)
->
toArray
();
$this
->
session
=
$session
;
$this
->
session
=
$session
;
}
}
...
@@ -62,7 +70,7 @@ class Controller
...
@@ -62,7 +70,7 @@ class Controller
throw
new
Exception
(
'Invalid authentication source'
);
throw
new
Exception
(
'Invalid authentication source'
);
}
}
$auth
=
new
\SimpleSAML\Auth\Simpl
e
(
$as
);
$auth
=
$this
->
factory
->
creat
e
(
$as
);
if
(
!
$auth
->
isAuthenticated
())
{
if
(
!
$auth
->
isAuthenticated
())
{
// not authenticated, start auth with specified source
// not authenticated, start auth with specified source
return
new
RedirectResponse
(
\SimpleSAML\Module
::
getModuleURL
(
'core/login/'
.
urlencode
(
$as
)));
return
new
RedirectResponse
(
\SimpleSAML\Module
::
getModuleURL
(
'core/login/'
.
urlencode
(
$as
)));
...
@@ -122,7 +130,7 @@ class Controller
...
@@ -122,7 +130,7 @@ class Controller
}
}
// at this point, we have a valid auth source selected, start auth
// at this point, we have a valid auth source selected, start auth
$auth
=
new
\SimpleSAML\Auth\Simpl
e
(
$as
);
$auth
=
$this
->
factory
->
creat
e
(
$as
);
$as
=
urlencode
(
$as
);
$as
=
urlencode
(
$as
);
if
(
$request
->
get
(
\SimpleSAML\Auth\State
::
EXCEPTION_PARAM
,
false
)
!==
false
)
{
if
(
$request
->
get
(
\SimpleSAML\Auth\State
::
EXCEPTION_PARAM
,
false
)
!==
false
)
{
...
@@ -160,7 +168,7 @@ class Controller
...
@@ -160,7 +168,7 @@ class Controller
*/
*/
public
function
logout
(
$as
)
public
function
logout
(
$as
)
{
{
$a
s
=
new
\SimpleSAML\Auth\Simple
(
$as
);
$a
uth
=
new
\SimpleSAML\Auth\Simple
(
$as
);
return
new
RunnableResponse
([
$a
s
,
'logout'
],
[
$this
->
config
->
getBasePath
()
.
'logout.php'
]);
return
new
RunnableResponse
([
$a
uth
,
'logout'
],
[
$this
->
config
->
getBasePath
()
.
'logout.php'
]);
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment