Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
SWITCHwayf
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
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
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
Guillaume Rousse
SWITCHwayf
Commits
5df46309
Commit
5df46309
authored
Apr 19, 2018
by
Lukas Haemmerle
Browse files
Options
Browse Files
Download
Plain Diff
Fixed conflict from branch 'rousse/SWITCHwayf-master+update-metadata'
parents
f54284cd
742727d0
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
77 deletions
+38
-77
bin/update-config.php
bin/update-config.php
+1
-1
bin/update-metadata.php
bin/update-metadata.php
+15
-21
lib/readMetadata.php
lib/readMetadata.php
+4
-4
lib/templates.php
lib/templates.php
+18
-51
No files found.
bin/update-config.php
View file @
5df46309
...
...
@@ -7,7 +7,7 @@ if (isset($_SERVER['REMOTE_ADDR'])){
exit
(
'No direct script access allowed'
);
}
$top
l
evelDir
=
dirname
(
__DIR__
);
$top
L
evelDir
=
dirname
(
__DIR__
);
$distConfigFilePath
=
$topLevelDir
.
'/etc/config.dist.php'
);
$newConfigFilePath
=
$topLevelDir
.
'/etc/config.new.php'
);
$currentConfigFilePath
=
$topLevelDir
.
'/etc/config.php'
);
...
...
bin/update-metadata.php
View file @
5df46309
...
...
@@ -2,17 +2,19 @@
$MAN
=
<<<PAGE
Name: SWITCHwayf
Author: Lukas Haemmerle, SWITCH
Description: This
file is used to dynamically create the list of
Description: This
script is used to dynamically create the list of
IdPs and SP to be displayed for the WAYF/DS service
based on the federation metadata.
Configuration parameters are specified in config.php.
The list of Identity Providers can also be updated
by running the script update-metadata.php
periodically as web server user, e.g. with a cron
It is intended to be run periodically, e.g. with a cron
entry like:
5 * * * * /usr/bin/php update-metadata.php > /dev/null
5 * * * * /usr/bin/php update-metadata.php \
--metadata-file /var/cache/shibboleth/metadata.switchaai.xml \
--metadata-idp-file /tmp/IDProvider.metadata.php \
--metadata-sp-file /tmp/SProvider.metadata.php \
> /dev/null
Usage:
Usage
-----
php update-metadata.php -help|-h
php update-metadata.php --metadata-file <file> \
--metadata-idp-file <file> --metadata-sp-file <file> \
...
...
@@ -21,16 +23,8 @@ php update-metadata.php --metadata-url <url> \
--metadata-idp-file <file> --metadata-sp-file <file> \
[--verbose | -v] [--min-sp-count <count>] [--min-idp-count <count>]
Example usage:
php update-metadata.php \
--metadata-file /var/cache/shibboleth/metadata.switchaai.xml \
--metadata-idp-file /tmp/IDProvider.metadata.php \
--metadata-sp-file /tmp/SProvider.metadata.php
Argument Description
-------------------
-------------------
-
--metadata-url <url> SAML2 metadata URL
--metadata-file <file> SAML2 metadata file
--metadata-idp-file <file> File containing Service Providers
...
...
@@ -44,7 +38,7 @@ Argument Description
PAGE;
$top
l
evelDir
=
dirname
(
__DIR__
);
$top
L
evelDir
=
dirname
(
__DIR__
);
require_once
(
$topLevelDir
.
'/lib/functions.php'
);
require_once
(
$topLevelDir
.
'/lib/readMetadata.php'
);
...
...
@@ -156,7 +150,7 @@ if (is_array($metadataIDProviders)){
}
if
(
$verbose
)
{
echo
"Dumping
pars
ed Identity Providers to file
$metadataIDPFile
\n
"
;
echo
"Dumping
$IDPCount
extract
ed Identity Providers to file
$metadataIDPFile
\n
"
;
}
dumpFile
(
$metadataTempIDPFile
,
$metadataIDProviders
,
'metadataIDProviders'
);
...
...
@@ -173,7 +167,7 @@ if (is_array($metadataSProviders)){
}
if
(
$verbose
)
{
echo
"Dumping
pars
ed Service Providers to file
$metadataSPFile
\n
"
;
echo
"Dumping
$SPCount
extract
ed Service Providers to file
$metadataSPFile
\n
"
;
}
dumpFile
(
$metadataTempSPFile
,
$metadataSProviders
,
'metadataSProviders'
);
...
...
lib/readMetadata.php
View file @
5df46309
...
...
@@ -46,8 +46,8 @@ function updateMetadata() {
// Now merge IDPs from metadata and static file
$IDProviders
=
mergeInfo
(
$IDProviders
,
$metadataIDProviders
,
$SAML2MetaOverLocalConf
,
$includeLocalConfEntries
);
//
For now copy the array by reference
$SProviders
=
&
$metadataSProviders
;
//
There is no static file for SPs, use metadata only
$SProviders
=
$metadataSProviders
;
}
elseif
(
file_exists
(
$metadataIDPFile
))
{
...
...
@@ -70,8 +70,8 @@ function updateMetadata() {
// Now merge IDPs from metadata and static file
$IDProviders
=
mergeInfo
(
$IDProviders
,
$metadataIDProviders
,
$SAML2MetaOverLocalConf
,
$includeLocalConfEntries
);
//
For now copy the array by reference
$SProviders
=
&
$metadataSProviders
;
//
There is no static file for SPs, use metadata only
$SProviders
=
$metadataSProviders
;
}
// Close the metadata lock file.
...
...
lib/templates.php
View file @
5df46309
...
...
@@ -21,13 +21,7 @@ function printHeader(){
global
$federationURL
,
$organizationURL
,
$faqURL
,
$helpURL
,
$privacyURL
;
global
$customStrings
;
// Check if custom header template exists
if
(
file_exists
(
'custom-header.php'
)){
include
(
'custom-header.php'
);
}
else
{
// Use default code
include
(
'default-header.php'
);
}
include
(
get_template
(
'header.php'
));
}
...
...
@@ -87,13 +81,7 @@ function printWAYF(){
$defaultSelected
=
(
$selectedIDP
==
'-'
)
?
'selected="selected"'
:
''
;
$rememberSelectionChecked
=
(
isset
(
$_COOKIE
[
$redirectStateCookieName
]))
?
'checked="checked"'
:
''
;
// Check if custom header template exists
if
(
file_exists
(
'custom-body.php'
)){
include
(
'custom-body.php'
);
}
else
{
// Use default code
include
(
'default-body.php'
);
}
include
(
get_template
(
'body.php'
));
}
/******************************************************************************/
...
...
@@ -106,13 +94,7 @@ function printSettings(){
$actionURL
=
$_SERVER
[
'SCRIPT_NAME'
]
.
'?'
.
htmlentities
(
$_SERVER
[
'QUERY_STRING'
]);
$defaultSelected
=
(
$selectedIDP
==
'-'
)
?
'selected="selected"'
:
''
;
// Check if custom header template exists
if
(
file_exists
(
'custom-settings.php'
)){
include
(
'custom-settings.php'
);
}
else
{
// Use default code
include
(
'default-settings.php'
);
}
include
(
get_template
(
'settings.php'
));
}
/******************************************************************************/
...
...
@@ -271,28 +253,13 @@ function printNotice(){
}
}
// Check if footer template exists
if
(
file_exists
(
'custom-notice.php'
)){
include
(
'custom-notice.php'
);
}
else
{
// Use default code
include
(
'default-notice.php'
);
}
include
(
get_template
(
'notice.php'
));
}
/******************************************************************************/
// Prints end of HTML page
function
printFooter
(){
global
$customStrings
;
// Check if footer template exists
if
(
file_exists
(
'custom-footer.php'
)){
include
(
'custom-footer.php'
);
}
else
{
// Use default code
include
(
'default-footer.php'
);
}
include
(
get_template
(
'footer.php'
));
}
/******************************************************************************/
...
...
@@ -305,13 +272,7 @@ function printError($message){
// Show Header
printHeader
();
// Check if error template exists
if
(
file_exists
(
'custom-error.php'
)){
include
(
'custom-error.php'
);
}
else
{
// Use default code
include
(
'default-error.php'
);
}
include
(
get_template
(
'error.php'
));
// Show footer
printFooter
();
...
...
@@ -433,12 +394,7 @@ function printEmbeddedConfigurationScript(){
header
(
'Content-type: text/plain;charset="utf-8"'
);
if
(
file_exists
(
'custom-embedded-wayf.php'
)){
include
(
'custom-embedded-wayf.php'
);
}
else
{
// Use default code
include
(
'default-embedded-wayf.php'
);
}
include
(
get_template
(
'embedded-wayf.php'
));
}
/******************************************************************************/
...
...
@@ -465,3 +421,14 @@ function printCSS($file){
echo
$cssContent
;
}
function
get_template
(
$name
)
{
global
$topLevelDir
;
$custom_template
=
$topLevelDir
.
'/lib/custom-'
.
$name
;
$default_template
=
$topLevelDir
.
'/lib/default-'
.
$name
;
return
(
file_exists
(
$custom_template
))
?
$custom_template
:
$default_template
;
}
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