mg-rest-util server¶
Methods¶
#.. autoclass:: mg_rest_util.mg_auth # :members:
Wrapper for authorization based on tokens
Example
1 2 3 4 5 6 7 8 9 10 11 12
from mg_rest_util.mg_auth import authorized class GetTest(Resource): @authorized def get(self, user_id): if user_id is not None: return "Valid user token" return { 'error': 'Forbidden', 'status': 403 }
-
mg_rest_util.mg_auth.
validate_token
(access_token)[source]¶ Verify that a MuG access token is valid
Parameters: access_token (str) – Returns: user_ids – - user_id : str
- The user_id, None if user does not exist or the test user_id if on a test server
- piblic_id : str
- The user_id for public datasets. This is set using the RESTful servers authoristation config file.
Return type: dict