mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-18 07:23:00 +00:00
allow service redirect uri to come from config
for external services - ensure Spawner.oauth_client_id is always defined, not just for running Spawners
This commit is contained in:
@@ -223,7 +223,7 @@ class Service(LoggingConfigurable):
|
||||
|
||||
oauth_client_id = Unicode(
|
||||
help="""OAuth client ID for this service.
|
||||
|
||||
|
||||
You shouldn't generally need to change this.
|
||||
Default: `service-<name>`
|
||||
"""
|
||||
@@ -232,6 +232,28 @@ class Service(LoggingConfigurable):
|
||||
def _default_client_id(self):
|
||||
return 'service-%s' % self.name
|
||||
|
||||
oauth_redirect_uri = Unicode(
|
||||
help="""OAuth redirect URI for this service.
|
||||
|
||||
You shouldn't generally need to change this.
|
||||
Default: `/services/:name/oauth_callback`
|
||||
"""
|
||||
).tag(input=True)
|
||||
@default('oauth_redirect_uri')
|
||||
def _default_redirect_uri(self):
|
||||
if self.server is None:
|
||||
return ''
|
||||
print(self.domain, self.host, self.server)
|
||||
return self.host + url_path_join(self.prefix, 'oauth_callback')
|
||||
|
||||
@property
|
||||
def oauth_available(self):
|
||||
"""Is OAuth available for this client?
|
||||
|
||||
Returns True if a server is defined or oauth_redirect_uri is specified manually
|
||||
"""
|
||||
return bool(self.server is not None or self.oauth_redirect_uri)
|
||||
|
||||
@property
|
||||
def server(self):
|
||||
if self.orm.server:
|
||||
|
Reference in New Issue
Block a user