From e880f1640168683d2d568fd88d1dd0ec0b29f0a6 Mon Sep 17 00:00:00 2001 From: Hsiaoming Yang Date: Mon, 18 Oct 2021 20:41:45 +0900 Subject: [PATCH] Rename parameters of InsufficientScopeError ref: https://github.com/lepture/authlib/pull/333 --- authlib/oauth2/rfc6750/errors.py | 6 +++--- authlib/oauth2/rfc6750/validator.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/authlib/oauth2/rfc6750/errors.py b/authlib/oauth2/rfc6750/errors.py index 80408d22..fe8029c3 100644 --- a/authlib/oauth2/rfc6750/errors.py +++ b/authlib/oauth2/rfc6750/errors.py @@ -78,14 +78,14 @@ class InsufficientScopeError(OAuth2Error): error = 'insufficient_scope' status_code = 403 - def __init__(self, token_scope, resource_scope): + def __init__(self, token_scope, required_scope): super(InsufficientScopeError, self).__init__() self.token_scope = token_scope - self.resource_scope = resource_scope + self.required_scope = required_scope def get_error_description(self): return self.gettext( 'The request requires higher privileges than ' 'provided by the access token. ' 'Required: "%(required)s", Provided:"%(provided)s"' - ) % dict(required=self.resource_scope, provided=self.token_scope) + ) % dict(required=self.required_scope, provided=self.token_scope) diff --git a/authlib/oauth2/rfc6750/validator.py b/authlib/oauth2/rfc6750/validator.py index fd71f867..fc26a149 100644 --- a/authlib/oauth2/rfc6750/validator.py +++ b/authlib/oauth2/rfc6750/validator.py @@ -95,5 +95,5 @@ def __call__(self, token_string, scope, request, scope_operator='AND'): if self.token_revoked(token): raise InvalidTokenError(realm=self.realm) if self.scope_insufficient(token, scope, scope_operator): - raise InsufficientScopeError(token_scope=token.get_scope(), resource_scope=scope) + raise InsufficientScopeError(token.get_scope(), scope) return token