From 7ea2f83c505c792a36d17cc0fc13301a885fb732 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Wed, 4 Jan 2023 06:37:32 +0300 Subject: auth: return group info as part of user details * gn3/app.py: import blueprint from authorisation views inorder to get all endpoints * gn3/auth/authentication/oauth2/views.py: remove the `/user` endpoint * gn3/auth/authorisation/views.py: add the `/user` endpoint and add the group information to the user details. --- gn3/auth/authentication/oauth2/views.py | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'gn3/auth/authentication') diff --git a/gn3/auth/authentication/oauth2/views.py b/gn3/auth/authentication/oauth2/views.py index 7d0d7dd..58fa6d4 100644 --- a/gn3/auth/authentication/oauth2/views.py +++ b/gn3/auth/authentication/oauth2/views.py @@ -1,9 +1,8 @@ """Endpoints for the oauth2 server""" import uuid -from flask import jsonify, Blueprint, current_app as app +from flask import Blueprint, current_app as app -from .resource_server import require_oauth from .endpoints.revocation import RevocationEndpoint from .endpoints.introspection import IntrospectionEndpoint @@ -41,15 +40,3 @@ def introspect_token(): """Provide introspection information for the token.""" return app.config["OAUTH2_SERVER"].create_endpoint_response( IntrospectionEndpoint.ENDPOINT_NAME) - -@oauth2.route("/user") -@require_oauth("profile") -def user_details(): - """Return user's details.""" - with require_oauth.acquire("profile") as the_token: - user = the_token.user - return jsonify({ - "user_id": user.user_id, - "email": user.email, - "name": user.name - }) -- cgit v1.2.3