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
822c08d5
Commit
822c08d5
authored
9 years ago
by
Jaime Perez Crespo
Browse files
Options
Downloads
Patches
Plain Diff
Fix phpdoc comments for sspmod_discopower_PowerIdPDisco.
parent
0a856dff
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/discopower/lib/PowerIdPDisco.php
+57
-35
57 additions, 35 deletions
modules/discopower/lib/PowerIdPDisco.php
with
57 additions
and
35 deletions
modules/discopower/lib/PowerIdPDisco.php
+
57
−
35
View file @
822c08d5
<?php
/**
* This class implements a generic IdP discovery service, for use in various IdP
*
discovery service pages. This should
reduce code duplication.
* This class implements a generic IdP discovery service, for use in various IdP
discovery service pages. This should
* reduce code duplication.
*
* This module extends the basic IdP disco handler, and add features like filtering
* and tabs.
* This module extends the basic IdP disco handler, and add features like filtering and tabs.
*
* @author Andreas Åkre Solberg <andreas@uninett.no>, UNINETT AS.
* @package
s
impleSAMLphp
* @package
S
impleSAMLphp
*/
class
sspmod_discopower_PowerIdPDisco
extends
SimpleSAML_XHTML_IdPDisco
{
/**
* The configuration for this instance.
*
* @var SimpleSAML_Configuration
*/
private
$discoconfig
;
/**
* The domain to use when saving common domain cookies.
*
This is NULL if support for common domain cookies is
disabled.
* The domain to use when saving common domain cookies.
This is null if support for common domain cookies is
* disabled.
*
* @var string|
NULL
* @var string|
null
*/
private
$cdcDomain
;
/**
* The lifetime of the CDC cookie, in seconds.
* If set to NULL, it will only be valid until the browser is closed.
* The lifetime of the CDC cookie, in seconds. If set to null, it will only be valid until the browser is closed.
*
* @var int|
NULL
* @var int|
null
*/
private
$cdcLifetime
;
...
...
@@ -36,11 +40,10 @@ class sspmod_discopower_PowerIdPDisco extends SimpleSAML_XHTML_IdPDisco {
/**
* Initializes this discovery service.
*
* The constructor does the parsing of the request. If this is an invalid request, it will
* throw an exception.
* The constructor does the parsing of the request. If this is an invalid request, it will throw an exception.
*
* @param array $metadataSets
Array with metadata sets we find remote entities in.
* @param string $instance
The name of this instance of the discovery service.
* @param array $metadataSets Array with metadata sets we find remote entities in.
* @param string $instance The name of this instance of the discovery service.
*/
public
function
__construct
(
array
$metadataSets
,
$instance
)
{
...
...
@@ -61,10 +64,9 @@ class sspmod_discopower_PowerIdPDisco extends SimpleSAML_XHTML_IdPDisco {
/**
* Log a message.
*
* This is an helper function for logging messages. It will prefix the messages with our
* discovery service type.
* This is an helper function for logging messages. It will prefix the messages with our discovery service type.
*
* @param $message
The message which should be logged.
* @param
string
$message The message which should be logged.
*/
protected
function
log
(
$message
)
{
SimpleSAML_Logger
::
info
(
'PowerIdPDisco.'
.
$this
->
instance
.
': '
.
$message
);
...
...
@@ -74,13 +76,12 @@ class sspmod_discopower_PowerIdPDisco extends SimpleSAML_XHTML_IdPDisco {
/**
* Compare two entities.
*
* This function is used to sort the entity list. It sorts based on english name,
* and will always put IdP's with names configured before those with only an
* entityID.
* This function is used to sort the entity list. It sorts based on english name, and will always put IdP's with
* names configured before those with only an entityID.
*
* @param array $a
The metadata of the first entity.
* @param array $b
The metadata of the second entity.
* @return int
How $a compares to $b.
* @param array $a The metadata of the first entity.
* @param array $b The metadata of the second entity.
* @return int How $a compares to $b.
*/
public
static
function
mcmp
(
array
$a
,
array
$b
)
{
if
(
isset
(
$a
[
'name'
][
'en'
])
&&
isset
(
$b
[
'name'
][
'en'
]))
{
...
...
@@ -95,8 +96,12 @@ class sspmod_discopower_PowerIdPDisco extends SimpleSAML_XHTML_IdPDisco {
}
/*
* This function will structure the idp list in a hierarchy based upon the tags.
/**
* Structure the list of IdPs in a hierarchy based upon the tags.
*
* @param array $list A list of IdPs.
*
* @return array The list of IdPs structured accordingly.
*/
protected
function
idplistStructured
(
$list
)
{
$slist
=
array
();
...
...
@@ -127,7 +132,17 @@ class sspmod_discopower_PowerIdPDisco extends SimpleSAML_XHTML_IdPDisco {
return
$slist
;
}
/**
* Do the actual filtering according the rules defined.
*
* @param array $filter A set of rules regarding filtering.
* @param array $entry An entry to be evaluated by the filters.
* @param boolean $default What to do in case the entity does not match any rules. Defaults to true.
*
* @return boolean True if the entity should be kept, false if it should be discarded according to the filters.
*/
private
function
processFilter
(
$filter
,
$entry
,
$default
=
TRUE
)
{
if
(
in_array
(
$entry
[
'entityid'
],
$filter
[
'entities.include'
]
))
return
TRUE
;
if
(
in_array
(
$entry
[
'entityid'
],
$filter
[
'entities.exclude'
]
))
return
FALSE
;
...
...
@@ -142,7 +157,16 @@ class sspmod_discopower_PowerIdPDisco extends SimpleSAML_XHTML_IdPDisco {
}
return
$default
;
}
/**
* Filter a list of entities according to any filters defined in the parent class, plus discopower configuration
* options regarding filtering.
*
* @param array $list A list of entities to filter.
*
* @return array The list in $list after filtering entities.
*/
protected
function
filterList
(
$list
)
{
parent
::
filterList
(
$list
);
...
...
@@ -210,7 +234,7 @@ class sspmod_discopower_PowerIdPDisco extends SimpleSAML_XHTML_IdPDisco {
/**
* Get the IdP entities saved in the common domain cookie.
*
* @return array
List of IdP entities.
* @return array List of IdP entities.
*/
private
function
getCDC
()
{
...
...
@@ -235,10 +259,9 @@ class sspmod_discopower_PowerIdPDisco extends SimpleSAML_XHTML_IdPDisco {
/**
* Save the current IdP choice to a cookie.
*
* This function overrides the corresponding function in the parent class,
* to add support for common domain cookie.
* This function overrides the corresponding function in the parent class, to add support for common domain cookie.
*
* @param string $idp
The entityID of the IdP.
* @param string $idp The entityID of the IdP.
*/
protected
function
setPreviousIdP
(
$idp
)
{
assert
(
'is_string($idp)'
);
...
...
@@ -287,10 +310,9 @@ class sspmod_discopower_PowerIdPDisco extends SimpleSAML_XHTML_IdPDisco {
/**
* Retrieve the previous IdP the user used.
*
* This function overrides the corresponding function in the parent class,
* to add support for common domain cookie.
* This function overrides the corresponding function in the parent class, to add support for common domain cookie.
*
* @return string|
NULL
The entity id of the previous IdP the user used, or
NULL
if this is the first time.
* @return string|
null
The entity id of the previous IdP the user used, or
null
if this is the first time.
*/
protected
function
getPreviousIdP
()
{
...
...
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