mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-12 12:33:02 +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:
@@ -203,6 +203,11 @@ class User:
|
||||
orm_spawner.state = self.state
|
||||
self.state = None
|
||||
|
||||
# use fully quoted name for client_id because it will be used in cookie-name
|
||||
# self.escaped_name may contain @ which is legal in URLs but not cookie keys
|
||||
client_id = 'user-%s' % quote(self.name)
|
||||
if name:
|
||||
client_id = '%s-%s' % (client_id, quote(name))
|
||||
spawn_kwargs = dict(
|
||||
user=self,
|
||||
orm_spawner=orm_spawner,
|
||||
@@ -211,6 +216,7 @@ class User:
|
||||
config=self.settings.get('config'),
|
||||
proxy_spec=url_path_join(self.proxy_spec, name, '/'),
|
||||
db=self.db,
|
||||
oauth_client_id=client_id,
|
||||
)
|
||||
# update with kwargs. Mainly for testing.
|
||||
spawn_kwargs.update(kwargs)
|
||||
@@ -355,12 +361,7 @@ class User:
|
||||
# create API and OAuth tokens
|
||||
spawner.api_token = api_token
|
||||
spawner.admin_access = self.settings.get('admin_access', False)
|
||||
# use fully quoted name for client_id because it will be used in cookie-name
|
||||
# self.escaped_name may contain @ which is legal in URLs but not cookie keys
|
||||
client_id = 'user-%s' % quote(self.name)
|
||||
if server_name:
|
||||
client_id = '%s-%s' % (client_id, quote(server_name))
|
||||
spawner.oauth_client_id = client_id
|
||||
client_id = spawner.oauth_client_id
|
||||
oauth_provider = self.settings.get('oauth_provider')
|
||||
if oauth_provider:
|
||||
client_store = oauth_provider.client_authenticator.client_store
|
||||
|
Reference in New Issue
Block a user