aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-01-31 04:45:53 +0300
committerFrederick Muriuki Muriithi2023-01-31 05:00:09 +0300
commit94b1f5b04bcee2ded0d0cbf11df4101bb86d6ce8 (patch)
tree3d77cbfeb72bd2e8898e26c72b9eb4e4009fc6fe /gn3
parenta523a767aecb7f1ced67788eda289f0d6c8e30fd (diff)
downloadgenenetwork3-94b1f5b04bcee2ded0d0cbf11df4101bb86d6ce8.tar.gz
auth: Set the token scope as a string, not a list
Setting the scope as a list of strings was leading to errors when attempting to logout. This commit leaves the scope as a string to avoid the errors.
Diffstat (limited to 'gn3')
-rw-r--r--gn3/auth/authentication/oauth2/models/oauth2token.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/gn3/auth/authentication/oauth2/models/oauth2token.py b/gn3/auth/authentication/oauth2/models/oauth2token.py
index 9495df4..c1fcafb 100644
--- a/gn3/auth/authentication/oauth2/models/oauth2token.py
+++ b/gn3/auth/authentication/oauth2/models/oauth2token.py
@@ -1,7 +1,7 @@
"""OAuth2 Token"""
import uuid
import datetime
-from typing import NamedTuple, Optional, Sequence
+from typing import NamedTuple, Optional
from pymonad.maybe import Just, Maybe, Nothing
@@ -17,7 +17,7 @@ class OAuth2Token(NamedTuple):
token_type: str
access_token: str
refresh_token: Optional[str]
- scope: Sequence[str]
+ scope: str
revoked: bool
issued_at: datetime.datetime
expires_in: int
@@ -38,7 +38,7 @@ class OAuth2Token(NamedTuple):
def get_scope(self) -> str:
"""Return the valid scope for the token."""
- return " ".join(self.scope)
+ return self.scope
def is_expired(self) -> bool:
"""Check whether the token is expired."""
@@ -60,7 +60,7 @@ def __token_from_resultset__(conn: db.DbConnection, rset) -> Maybe:
token_type=rset["token_type"],
access_token=rset["access_token"],
refresh_token=rset["refresh_token"],
- scope=rset["scope"].split(None),
+ scope=rset["scope"],
revoked=(rset["revoked"] == 1),
issued_at=datetime.datetime.fromtimestamp(
rset["issued_at"]),