test access scopes in authorize handler

- provider.add_client returns the client
- fix Spawner access scopes
- debug logging in mock spawners
- Assign service access scopes
This commit is contained in:
Min RK
2021-05-20 11:28:27 +02:00
parent 0ba222b288
commit 69d2839ba3
6 changed files with 168 additions and 41 deletions

View File

@@ -514,9 +514,7 @@ class Hashed(Expiring):
@classmethod
def check_token(cls, db, token):
"""Check if a token is acceptable"""
print("checking", cls, token, len(token), cls.min_length)
if len(token) < cls.min_length:
print("raising")
raise ValueError(
"Tokens must be at least %i characters, got %r"
% (cls.min_length, token)
@@ -773,6 +771,11 @@ class OAuthCode(Expiring, Base):
.first()
)
def __repr__(self):
return (
f"<{self.__class__.__name__}(id={self.id}, client_id={self.client_id!r})>"
)
class OAuthClient(Base):
__tablename__ = 'oauth_clients'
@@ -795,6 +798,9 @@ class OAuthClient(Base):
# *not* the roles of the client itself
allowed_roles = relationship('Role', secondary='oauth_client_role_map')
def __repr__(self):
return f"<{self.__class__.__name__}(identifier={self.identifier!r})>"
# General database utilities