Skip to content

Commit

Permalink
Merge branch 'master' into feat/cert-audit-log
Browse files Browse the repository at this point in the history
  • Loading branch information
mfshao committed Nov 21, 2019
2 parents 7729f12 + b3927b0 commit e3a7657
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# To run: docker run -d -v /path/to/fence-config.yaml:/var/www/fence/fence-config.yaml --name=fence -p 80:80 fence
# To check running container: docker exec -it fence /bin/bash

FROM quay.io/cdis/python-nginx:pybase3-1.0.0
FROM quay.io/cdis/python-nginx:pybase3-1.1.0

ENV appname=fence

Expand Down
10 changes: 7 additions & 3 deletions fence/blueprints/login/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def default_login():
The default root login route.
"""
# default login option
if "DEFAULT_LOGIN_IDP" in config:
if config.get("DEFAULT_LOGIN_IDP"):
default_idp = config["DEFAULT_LOGIN_IDP"]
elif "default" in config.get("ENABLED_IDENTITY_PROVIDERS", {}):
# fall back on ENABLED_IDENTITY_PROVIDERS.default
Expand Down Expand Up @@ -219,15 +219,19 @@ def provider_info(login_details):
provider_info(login_details) for login_details in login_options
]
except KeyError as e:
raise InternalError("login options misconfigured: {}".format(e))
raise InternalError("LOGIN_OPTIONS misconfigured: {}".format(e))

# if several login_options are defined for this default IDP, will
# default to the first one:
default_provider_info = next(
(info for info in all_provider_info if info["idp"] == default_idp), None
)
if not default_provider_info:
raise InternalError("default provider misconfigured")
raise InternalError(
"default provider misconfigured: DEFAULT_LOGIN_IDP is set to {}, which is not configured in LOGIN_OPTIONS".format(
default_idp
)
)

return flask.jsonify(
{"default_provider": default_provider_info, "providers": all_provider_info}
Expand Down
2 changes: 1 addition & 1 deletion fence/config-default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ LOGIN_OPTIONS: [] # !!! remove the empty list to enable login options!
# - Google? Use: '{{BASE_URL}}/login/google'
# - Multi-tenant fence (e.g. another fence instance)? Use: '{{BASE_URL}}/login/fence'
# - Sibboleth? Use: '{{BASE_URL}}/login/shib'
DEFAULT_LOGIN_IDP: google
DEFAULT_LOGIN_IDP: null
DEFAULT_LOGIN_URL: '{{BASE_URL}}/login/google'

# `LOGIN_REDIRECT_WHITELIST` is a list of extra whitelisted URLs which can be redirected
Expand Down

0 comments on commit e3a7657

Please sign in to comment.