refac
This commit is contained in:
@@ -687,7 +687,6 @@ def load_oauth_providers():
|
||||
return client
|
||||
|
||||
OAUTH_PROVIDERS['google'] = {
|
||||
'redirect_uri': GOOGLE_REDIRECT_URI.value,
|
||||
'register': google_oauth_register,
|
||||
}
|
||||
|
||||
@@ -708,7 +707,6 @@ def load_oauth_providers():
|
||||
return client
|
||||
|
||||
OAUTH_PROVIDERS['microsoft'] = {
|
||||
'redirect_uri': MICROSOFT_REDIRECT_URI.value,
|
||||
'picture_url': MICROSOFT_CLIENT_PICTURE_URL.value,
|
||||
'register': microsoft_oauth_register,
|
||||
}
|
||||
@@ -733,7 +731,6 @@ def load_oauth_providers():
|
||||
return client
|
||||
|
||||
OAUTH_PROVIDERS['github'] = {
|
||||
'redirect_uri': GITHUB_CLIENT_REDIRECT_URI.value,
|
||||
'register': github_oauth_register,
|
||||
'sub_claim': 'id',
|
||||
}
|
||||
@@ -775,7 +772,6 @@ def load_oauth_providers():
|
||||
|
||||
OAUTH_PROVIDERS['oidc'] = {
|
||||
'name': OAUTH_PROVIDER_NAME.value,
|
||||
'redirect_uri': OPENID_REDIRECT_URI.value,
|
||||
'register': oidc_oauth_register,
|
||||
}
|
||||
|
||||
|
||||
@@ -1354,12 +1354,13 @@ class OAuthManager:
|
||||
if provider not in OAUTH_PROVIDERS:
|
||||
raise HTTPException(404)
|
||||
# If the provider has a custom redirect URL, use that, otherwise automatically generate one
|
||||
redirect_uri = OAUTH_PROVIDERS[provider].get('redirect_uri') or request.url_for(
|
||||
'oauth_login_callback', provider=provider
|
||||
)
|
||||
client = self.get_client(provider)
|
||||
if client is None:
|
||||
raise HTTPException(404)
|
||||
redirect_uri = (
|
||||
(client.server_metadata or {}).get('redirect_uri')
|
||||
or request.url_for('oauth_login_callback', provider=provider)
|
||||
)
|
||||
|
||||
kwargs = {}
|
||||
if auth_manager_config.OAUTH_AUDIENCE:
|
||||
|
||||
Reference in New Issue
Block a user