Open jace opened 8 years ago
So we have a few complications:
before_request
now calls token_auth
asking it to check for a valid token for resource *
before_request
we don't yet know which endpoint is going to be called or what resource scope is required, we have no option but to check for *
token/verify
endpoint, which returns True/False for the given token and resource name.Instead, Lastuser should provide a token/get_scope
endpoint that returns all the resources this token provides access to, and let the client app (a) cache this single assertion instead of a separate assertion per request, and (b) confirm it's valid when the actual view is called.
@jace can you elaborate this part a little -
Register the view as a resource
It means they have to do the same thing as the resource_handler
decorator.
Flask-Lastuser's old resource decorator is clunky and has never been used in production. The
before_request
handler, however, has recently acquired the ability to parse an access token like a session cookie and load the linked user.This mechanism should extend to
requires_login
andrequires_permission
, both of which should:scope
parameter;