[WEB - 1827]remove: migration for account and social login connection (#5013)
* fix: OAuth adapter error codes + missing account provider migration that introduces GitLab (#4998) * feat(apiserver): GitLab OAuth client * feat(admin,packages,space,web): GitLab OAuth client * Feat(apiserver/oauth): authentication_error_code() * chore: remove empty files introduced by rebase * dev: delete migration --------- Co-authored-by: jon ⚝ <jon@allmende.io>
This commit is contained in:
parent
83587c2c6b
commit
c8491a13b3
1 changed files with 12 additions and 10 deletions
|
|
@ -39,6 +39,16 @@ class OauthAdapter(Adapter):
|
|||
self.client_secret = client_secret
|
||||
self.code = code
|
||||
|
||||
def authentication_error_code(self):
|
||||
if self.provider == "google":
|
||||
return "GOOGLE_OAUTH_PROVIDER_ERROR"
|
||||
elif self.provider == "github":
|
||||
return "GITHUB_OAUTH_PROVIDER_ERROR"
|
||||
elif self.provider == "gitlab":
|
||||
return "GITLAB_OAUTH_PROVIDER_ERROR"
|
||||
else:
|
||||
return "OAUTH_NOT_CONFIGURED"
|
||||
|
||||
def get_auth_url(self):
|
||||
return self.auth_url
|
||||
|
||||
|
|
@ -62,7 +72,7 @@ class OauthAdapter(Adapter):
|
|||
response.raise_for_status()
|
||||
return response.json()
|
||||
except requests.RequestException:
|
||||
code = self._provider_error_code()
|
||||
code = self.authentication_error_code()
|
||||
raise AuthenticationException(
|
||||
error_code=AUTHENTICATION_ERROR_CODES[code],
|
||||
error_message=str(code),
|
||||
|
|
@ -77,15 +87,7 @@ class OauthAdapter(Adapter):
|
|||
response.raise_for_status()
|
||||
return response.json()
|
||||
except requests.RequestException:
|
||||
if self.provider == "google":
|
||||
code = "GOOGLE_OAUTH_PROVIDER_ERROR"
|
||||
elif self.provider == "github":
|
||||
code = "GITHUB_OAUTH_PROVIDER_ERROR"
|
||||
elif self.provider == "gitlab":
|
||||
code = "GITLAB_OAUTH_PROVIDER_ERROR"
|
||||
else:
|
||||
code = "OAUTH_NOT_CONFIGURED"
|
||||
|
||||
code = self.authentication_error_code()
|
||||
raise AuthenticationException(
|
||||
error_code=AUTHENTICATION_ERROR_CODES[code],
|
||||
error_message=str(code),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue