diff --git a/oauth/loginmanager.py b/oauth/loginmanager.py index 457fc2343..2504d661b 100644 --- a/oauth/loginmanager.py +++ b/oauth/loginmanager.py @@ -12,7 +12,7 @@ PREFIX_BLACKLIST = ['ldap', 'jwt', 'keystone'] class OAuthLoginManager(object): """ Helper class which manages all registered OAuth login services. """ - def __init__(self, config): + def __init__(self, config, client=None): self.services = [] # Register the endpoints for each of the OAuth login services. @@ -28,7 +28,7 @@ class OAuthLoginManager(object): if prefix in PREFIX_BLACKLIST: raise Exception('Cannot use reserved config name %s' % key) - self.services.append(OIDCLoginService(config, key)) + self.services.append(OIDCLoginService(config, key, client=client)) def get_service(self, service_id): for service in self.services: diff --git a/oauth/oidc.py b/oauth/oidc.py index f858bb1b3..f3dab2032 100644 --- a/oauth/oidc.py +++ b/oauth/oidc.py @@ -34,12 +34,12 @@ class PublicKeyLoadException(Exception): class OIDCLoginService(OAuthService): """ Defines a generic service for all OpenID-connect compatible login services. """ - def __init__(self, config, key_name): + def __init__(self, config, key_name, client=None): super(OIDCLoginService, self).__init__(config, key_name) self._public_key_cache = TTLCache(1, PUBLIC_KEY_CACHE_TTL, missing=self._load_public_key) self._id = key_name[0:key_name.find('_')].lower() - self._http_client = config['HTTPCLIENT'] + self._http_client = client or config['HTTPCLIENT'] self._mailing = config.get('FEATURE_MAILING', False) def service_id(self): @@ -71,6 +71,9 @@ class OIDCLoginService(OAuthService): def user_endpoint(self): return self._oidc_config().get('userinfo_endpoint') + def validate(self): + return bool(self.user_endpoint()) + def validate_client_id_and_secret(self, http_client, app_config): # TODO: find a way to verify client secret too. check_auth_url = http_client.get(self.get_auth_url()) diff --git a/static/css/core-ui.css b/static/css/core-ui.css index 89a82ad7d..c273a6633 100644 --- a/static/css/core-ui.css +++ b/static/css/core-ui.css @@ -431,6 +431,18 @@ a:focus { border-top: 1px solid #eee; } +.co-panel-body .co-panel-heading { + font-size: 120%; + border-bottom: 0px; + margin: 0px; + margin-bottom: -6px; +} + +.co-panel-body .co-panel-body { + padding-left: 38px; +} + + .config-bool-field-element input { margin-right: 6px; font-size: 24px; diff --git a/static/directives/config/config-setup-tool.html b/static/directives/config/config-setup-tool.html index 23b043399..12caf46cd 100644 --- a/static/directives/config/config-setup-tool.html +++ b/static/directives/config/config-setup-tool.html @@ -525,17 +525,18 @@ - +
Authentication for the registry can be handled by either the registry itself, LDAP or external JWT endpoint.
-
- Additional external authentication providers (such as GitHub) can be used on top of this choice.
+
+ Additional external authentication providers (such as GitHub) can be used in addition for login into the UI.
- If enabled, users can use GitHub or GitHub Enterprise to authenticate to the registry. -
-- Note: A registered GitHub (Enterprise) OAuth application is required. - View instructions on how to - - Create an OAuth Application in GitHub - -
+ ++ If enabled, users can use GitHub or GitHub Enterprise to authenticate to the registry. +
++ Note: A registered GitHub (Enterprise) OAuth application is required. + View instructions on how to + + Create an OAuth Application in GitHub + +
+GitHub: | ++ + | +
GitHub Endpoint: | +
+
+
+
+ The GitHub Enterprise endpoint. Must start with http:// or https://.
+
+ |
+
OAuth Client ID: | ++ + + | +
OAuth Client Secret: | ++ + + | +
Organization Filtering: | +
+
+ Restrict By Organization Membership
+
+
+
+ If enabled, only members of specified GitHub
+ Enterprise organizations will be allowed to login via GitHub
+ Enterprise.
+
+
+
+
+ |
+
+ If enabled, users can use Google to authenticate to the registry. +
++ Note: A registered Google OAuth application is required. + Visit the + + Google Developer Console + + to register an application. +
+OAuth Client ID: | ++ + + | +
OAuth Client Secret: | ++ + + | +
Service ID: | +
+ {{ getOIDCProviderId(provider) }}
+ |
+
OIDC Server: | +
+
+
+
+ The URL of an OIDC-compliant server.
+
+ |
+
Service Name: | +
+
+
+
+ The user friendly name to display for the service on the login page.
+
+ |
+
Service Icon (optional): | +
+
+
+
+ If specified, the icon to display for this login service on the login page. Can be either a URL to an icon or a CSS class name from Font Awesome
+
+ |
+
Binding Field: | +
+
+
+ If selected, when a user logs in via this OIDC provider, they will be automatically bound to their user in {{ config.AUTHENTICATION_TYPE }} by matching the selected field from the OIDC provider to the associated user in {{ config.AUTHENTICATION_TYPE }}.
+
+
+ For example, selecting
+ Subject here with a backing authentication system of LDAP means that a user logging in via this OIDC provider will also be bound to their user in LDAP by username.
+
+ If none selected, a user unique to will be created on initial login with this OIDC provider. This is not the recommended setup.
+
+ |
+
GitHub: | -- - | -
GitHub Endpoint: | -
-
-
-
- The GitHub Enterprise endpoint. Must start with http:// or https://.
-
- |
-
OAuth Client ID: | -- - - | -
OAuth Client Secret: | -- - - | -
Organization Filtering: | -
-
- Restrict By Organization Membership
-
-
-
- If enabled, only members of specified GitHub
- Enterprise organizations will be allowed to login via GitHub
- Enterprise.
-
-
-
-
- |
-
- If enabled, users can use Google to authenticate to the registry. -
-- Note: A registered Google OAuth application is required. - Visit the - - Google Developer Console - - to register an application. -
-OAuth Client ID: | -- - - | -
OAuth Client Secret: | -- - - | -