mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-14 21:43:01 +00:00
add description to oauth clients for services and user servers
This commit is contained in:
@@ -1222,6 +1222,7 @@ class JupyterHub(Application):
|
|||||||
client_id=service.oauth_client_id,
|
client_id=service.oauth_client_id,
|
||||||
client_secret=service.api_token,
|
client_secret=service.api_token,
|
||||||
redirect_uri=service.oauth_redirect_uri,
|
redirect_uri=service.oauth_redirect_uri,
|
||||||
|
description="JupyterHub service %s" % service.name,
|
||||||
)
|
)
|
||||||
|
|
||||||
self._service_map[name] = service
|
self._service_map[name] = service
|
||||||
|
@@ -195,10 +195,10 @@ class ClientStore(HubDBMixin, oauth2.store.ClientStore):
|
|||||||
redirect_uris=[orm_client.redirect_uri],
|
redirect_uris=[orm_client.redirect_uri],
|
||||||
secret=HashComparable(orm_client.secret),
|
secret=HashComparable(orm_client.secret),
|
||||||
)
|
)
|
||||||
|
|
||||||
def add_client(self, client_id, client_secret, redirect_uri):
|
def add_client(self, client_id, client_secret, redirect_uri, description=''):
|
||||||
"""Add a client
|
"""Add a client
|
||||||
|
|
||||||
hash its client_secret before putting it in the database.
|
hash its client_secret before putting it in the database.
|
||||||
"""
|
"""
|
||||||
# clear existing clients with same ID
|
# clear existing clients with same ID
|
||||||
@@ -212,6 +212,7 @@ class ClientStore(HubDBMixin, oauth2.store.ClientStore):
|
|||||||
identifier=client_id,
|
identifier=client_id,
|
||||||
secret=hash_token(client_secret),
|
secret=hash_token(client_secret),
|
||||||
redirect_uri=redirect_uri,
|
redirect_uri=redirect_uri,
|
||||||
|
description=description,
|
||||||
)
|
)
|
||||||
self.db.add(orm_client)
|
self.db.add(orm_client)
|
||||||
self.db.commit()
|
self.db.commit()
|
||||||
@@ -222,7 +223,7 @@ def make_provider(session_factory, url_prefix, login_url):
|
|||||||
token_store = AccessTokenStore(session_factory)
|
token_store = AccessTokenStore(session_factory)
|
||||||
code_store = AuthCodeStore(session_factory)
|
code_store = AuthCodeStore(session_factory)
|
||||||
client_store = ClientStore(session_factory)
|
client_store = ClientStore(session_factory)
|
||||||
|
|
||||||
provider = Provider(
|
provider = Provider(
|
||||||
access_token_store=token_store,
|
access_token_store=token_store,
|
||||||
auth_code_store=code_store,
|
auth_code_store=code_store,
|
||||||
|
@@ -381,6 +381,7 @@ class User:
|
|||||||
# containers that resume will be updated below
|
# containers that resume will be updated below
|
||||||
client_store.add_client(client_id, api_token,
|
client_store.add_client(client_id, api_token,
|
||||||
url_path_join(self.url, server_name, 'oauth_callback'),
|
url_path_join(self.url, server_name, 'oauth_callback'),
|
||||||
|
description="Server at %s" % url_path_join(self.url, server_name),
|
||||||
)
|
)
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user