-
-
Notifications
You must be signed in to change notification settings - Fork 376
feat(auth): add OAuth 2.1 client admin endpoints #1240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9149590
d6c292b
5265d6d
bb3165f
a42b3f1
b9f5562
dbd801d
b9cd222
9c98898
1985f42
be343b8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |
| name: auth-tests | ||
| services: | ||
| gotrue: # Signup enabled, autoconfirm off | ||
| image: supabase/auth:v2.178.0 | ||
| image: supabase/auth:v2.180.0 | ||
| ports: | ||
| - '9999:9999' | ||
| environment: | ||
|
|
@@ -43,7 +43,7 @@ services: | |
| - db | ||
| restart: on-failure | ||
| autoconfirm: # Signup enabled, autoconfirm on | ||
| image: supabase/auth:v2.178.0 | ||
| image: supabase/auth:v2.180.0 | ||
| ports: | ||
| - '9998:9998' | ||
| environment: | ||
|
|
@@ -70,11 +70,13 @@ services: | |
| GOTRUE_SMTP_PASS: GOTRUE_SMTP_PASS | ||
| GOTRUE_SMTP_ADMIN_EMAIL: [email protected] | ||
| GOTRUE_COOKIE_KEY: 'sb' | ||
| GOTRUE_OAUTH_SERVER_ENABLED: 'true' | ||
| GOTRUE_OAUTH_SERVER_ALLOW_DYNAMIC_REGISTRATION: 'true' | ||
| depends_on: | ||
| - db | ||
| restart: on-failure | ||
| autoconfirm_with_asymmetric_keys: # Signup enabled, autoconfirm on | ||
| image: supabase/auth:v2.169.0 | ||
| image: supabase/auth:v2.180.0 | ||
| ports: | ||
| - '9996:9996' | ||
| environment: | ||
|
|
@@ -105,7 +107,7 @@ services: | |
| - db | ||
| restart: on-failure | ||
| disabled: # Signup disabled | ||
| image: supabase/auth:v2.178.0 | ||
| image: supabase/auth:v2.180.0 | ||
| ports: | ||
| - '9997:9997' | ||
| environment: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| from ..types import ( | ||
| CreateOAuthClientParams, | ||
| OAuthClientListResponse, | ||
| OAuthClientResponse, | ||
| PageParams, | ||
| UpdateOAuthClientParams, | ||
| ) | ||
| from typing import Optional | ||
|
|
||
|
|
||
| class AsyncGoTrueAdminOAuthAPI: | ||
| """ | ||
| Contains all OAuth client administration methods. | ||
| Only relevant when the OAuth 2.1 server is enabled in Supabase Auth. | ||
| """ | ||
|
|
||
| async def list_clients( | ||
| self, | ||
| params: Optional[PageParams] = None, | ||
| ) -> OAuthClientListResponse: | ||
| """ | ||
| Lists all OAuth clients with optional pagination. | ||
| Only relevant when the OAuth 2.1 server is enabled in Supabase Auth. | ||
| This function should only be called on a server. | ||
| Never expose your `service_role` key in the browser. | ||
| """ | ||
| raise NotImplementedError() # pragma: no cover | ||
|
|
||
| async def create_client( | ||
| self, | ||
| params: CreateOAuthClientParams, | ||
| ) -> OAuthClientResponse: | ||
| """ | ||
| Creates a new OAuth client. | ||
| Only relevant when the OAuth 2.1 server is enabled in Supabase Auth. | ||
| This function should only be called on a server. | ||
| Never expose your `service_role` key in the browser. | ||
| """ | ||
| raise NotImplementedError() # pragma: no cover | ||
|
|
||
| async def get_client( | ||
| self, | ||
| client_id: str, | ||
| ) -> OAuthClientResponse: | ||
| """ | ||
| Gets details of a specific OAuth client. | ||
| Only relevant when the OAuth 2.1 server is enabled in Supabase Auth. | ||
| This function should only be called on a server. | ||
| Never expose your `service_role` key in the browser. | ||
| """ | ||
| raise NotImplementedError() # pragma: no cover | ||
|
|
||
| async def update_client( | ||
| self, | ||
| client_id: str, | ||
| params: UpdateOAuthClientParams, | ||
| ) -> OAuthClientResponse: | ||
| """ | ||
| Updates an OAuth client. | ||
| Only relevant when the OAuth 2.1 server is enabled in Supabase Auth. | ||
| This function should only be called on a server. | ||
| Never expose your `service_role` key in the browser. | ||
| """ | ||
| raise NotImplementedError() # pragma: no cover | ||
|
|
||
| async def delete_client( | ||
| self, | ||
| client_id: str, | ||
| ) -> OAuthClientResponse: | ||
| """ | ||
| Deletes an OAuth client. | ||
| Only relevant when the OAuth 2.1 server is enabled in Supabase Auth. | ||
| This function should only be called on a server. | ||
| Never expose your `service_role` key in the browser. | ||
| """ | ||
| raise NotImplementedError() # pragma: no cover | ||
|
|
||
| async def regenerate_client_secret( | ||
| self, | ||
| client_id: str, | ||
| ) -> OAuthClientResponse: | ||
| """ | ||
| Regenerates the secret for an OAuth client. | ||
| Only relevant when the OAuth 2.1 server is enabled in Supabase Auth. | ||
| This function should only be called on a server. | ||
| Never expose your `service_role` key in the browser. | ||
| """ | ||
| raise NotImplementedError() # pragma: no cover | ||
|
Comment on lines
+10
to
+94
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand this is done to be the same as the other "namespace classes" that already exist in this package, but I believe all of these should hold the actual implementation of the class, instead of having these ugly and confusing placeholders. It can be like this for now, I will refactor this in a later PR. |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@o-santi I'm using this uuid validation because it was already what was being used by other methods.
Since this is a new feature, does it make sense for the
client_idparam to be of typeuuid.UUIDinstead of a rawstr? So we don't need to validate it? We do this in Swift, but I don't know about Python.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be, I agree with you. But I think for now, we should maintain this behavior for consistency with the other methods, as otherwise the user might need to have some ids in
strand others inUUID, which is not really intuitive.