mirror of https://github.com/samply/bridgehead.git
Account for ip address host values
This commit is contained in:
parent
46a2affe93
commit
0f0627975c
|
@ -242,7 +242,7 @@ add_basic_auth_user() {
|
||||||
|
|
||||||
SECRET_SYNC_ARGS=${SECRET_SYNC_ARGS:-""}
|
SECRET_SYNC_ARGS=${SECRET_SYNC_ARGS:-""}
|
||||||
# First argument is the variable name that will be generated it will not have a value.
|
# First argument is the variable name that will be generated it will not have a value.
|
||||||
# Second argument is a comma seperated list of allowed redirect urls for the oidc client.
|
# Second argument is a comma separated list of allowed redirect urls for the oidc client.
|
||||||
# The resulting client id will be $SITE_ID-public
|
# The resulting client id will be $SITE_ID-public
|
||||||
function generate_public_oidc_client() {
|
function generate_public_oidc_client() {
|
||||||
local delimiter=$'\x1E'
|
local delimiter=$'\x1E'
|
||||||
|
@ -253,8 +253,8 @@ function generate_public_oidc_client() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# First argument is the variable name that the client secret will be avalible at.
|
# First argument is the variable name that the client secret will be available at.
|
||||||
# Second argument is a comma seperated list of allowed redirect urls for the oidc client.
|
# Second argument is a comma separated list of allowed redirect urls for the oidc client.
|
||||||
# The resulting client id will be $SITE_ID-private
|
# The resulting client id will be $SITE_ID-private
|
||||||
function generate_private_oidc_client() {
|
function generate_private_oidc_client() {
|
||||||
local delimiter=$'\x1E'
|
local delimiter=$'\x1E'
|
||||||
|
@ -293,11 +293,15 @@ capitalize_first_letter() {
|
||||||
echo "$capitalized"
|
echo "$capitalized"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Generate a string of ',' separated string of redirect urls relative to $HOST.
|
||||||
|
# $1 will be appended to the url
|
||||||
|
# If the host looks like dev-jan.inet.dkfz-heidelberg.de it will generate urls with dev-jan and the original $HOST as url Authorities
|
||||||
generate_redirect_urls(){
|
generate_redirect_urls(){
|
||||||
local redirect_urls="https://${HOST}$1"
|
local redirect_urls="https://${HOST}$1"
|
||||||
local host_without_proxy="$(echo "$HOST" | cut -d '.' -f1)"
|
local host_without_proxy="$(echo "$HOST" | cut -d '.' -f1)"
|
||||||
if [[ "$HOST" != "$host_without_proxy" ]]; then
|
# Only append second url if its different and the host is not an ip address
|
||||||
redirect_urls+=",https://$host_without_proxy$port$1"
|
if [[ "$HOST" != "$host_without_proxy" && ! "$HOST" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||||
|
redirect_urls+=",https://$host_without_proxy$1"
|
||||||
fi
|
fi
|
||||||
echo "$redirect_urls"
|
echo "$redirect_urls"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue