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
b95b0229
Unverified
Commit
b95b0229
authored
7 years ago
by
Jaime Pérez Crespo
Browse files
Options
Downloads
Patches
Plain Diff
Add a configuration option to specify the base URL for the application protected.
parent
fe8688bb
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
config-templates/config.php
+22
-0
22 additions, 0 deletions
config-templates/config.php
lib/SimpleSAML/Utils/HTTP.php
+18
-7
18 additions, 7 deletions
lib/SimpleSAML/Utils/HTTP.php
with
40 additions
and
7 deletions
config-templates/config.php
+
22
−
0
View file @
b95b0229
...
...
@@ -30,6 +30,28 @@ $config = array(
*/
'baseurlpath'
=>
'simplesaml/'
,
/*
* The 'application' configuration array groups a set configuration options
* relative to an application protected by SimpleSAMLphp.
*/
//'application' => array(
/*
* The 'baseURL' configuration option allows you to specify a protocol,
* host and optionally a port that serves as the canonical base for all
* your application's URLs. This is useful when the environment
* observed in the server differs from the one observed by end users,
* for example, when using a load balancer to offload TLS.
*
* Note that this configuration option does not allow setting a path as
* part of the URL. If your setup involves URL rewriting or any other
* tricks that would result in SimpleSAMLphp observing a URL for your
* application's scripts different than the canonical one, you will
* need to compute the right URLs yourself and pass them dynamically
* to SimpleSAMLphp's API.
*/
//'baseURL' => 'https://example.com'
//),
/*
* The following settings are *filesystem paths* which define where
* SimpleSAMLphp can find or write the following things:
...
...
This diff is collapsed.
Click to expand it.
lib/SimpleSAML/Utils/HTTP.php
+
18
−
7
View file @
b95b0229
...
...
@@ -778,15 +778,26 @@ class HTTP
* directory of SimpleSAMLphp, the URI does not contain its relative path, and $uri_pos is false.
*
* It doesn't matter which one of those cases we have. We just know we can't apply our base URL to the
* current URI, so we need to build it back from the PHP environment.
* current URI, so we need to build it back from the PHP environment, unless we have a base URL specified
* for this case in the configuration. First, check if that's the case.
*/
$protocol
=
'http'
;
$protocol
.
=
(
self
::
getServerHTTPS
())
?
's'
:
''
;
$protocol
.
=
'://'
;
$hostname
=
self
::
getServerHost
();
$port
=
self
::
getServerPort
();
return
$protocol
.
$hostname
.
$port
.
$_SERVER
[
'REQUEST_URI'
];
/** @var \SimpleSAML_Configuration $appcfg */
$appcfg
=
$cfg
->
getConfigItem
(
'application'
,
array
());
$appurl
=
$appcfg
->
getString
(
'baseURL'
,
''
);
if
(
!
empty
(
$appurl
))
{
$protocol
=
parse_url
(
$appurl
,
PHP_URL_SCHEME
);
$hostname
=
parse_url
(
$appurl
,
PHP_URL_HOST
);
$port
=
parse_url
(
$appurl
,
PHP_URL_PORT
);
$port
=
!
empty
(
$port
)
?
':'
.
$port
:
''
;
}
else
{
// no base URL specified for app, just use the current URL
$protocol
=
'http'
;
$protocol
.
=
(
self
::
getServerHTTPS
())
?
's'
:
''
;
$hostname
=
self
::
getServerHost
();
$port
=
self
::
getServerPort
();
}
return
$protocol
.
'://'
.
$hostname
.
$port
.
$_SERVER
[
'REQUEST_URI'
];
}
return
self
::
getBaseURL
()
.
$rel_path
.
substr
(
$_SERVER
[
'REQUEST_URI'
],
$uri_pos
+
strlen
(
$url_path
));
...
...
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