diff --git a/neon_hana/app/routers/auth.py b/neon_hana/app/routers/auth.py index 4cf78e2..09d7551 100644 --- a/neon_hana/app/routers/auth.py +++ b/neon_hana/app/routers/auth.py @@ -27,6 +27,7 @@ from fastapi import APIRouter, Request from neon_hana.app.dependencies import client_manager +from neon_hana.auth.permissions import ClientPermissions from neon_hana.schema.auth_requests import * auth_route = APIRouter(prefix="/auth", tags=["authentication"]) @@ -42,3 +43,8 @@ async def check_login(auth_request: AuthenticationRequest, @auth_route.post("/refresh") async def check_refresh(request: RefreshRequest) -> AuthenticationResponse: return client_manager.check_refresh_request(**dict(request)) + + +@auth_route.post("/permissions") +async def check_permissions(request: PermissionsRequest) -> ClientPermissions: + return client_manager.get_permissions(request.client_id) \ No newline at end of file diff --git a/neon_hana/auth/permissions.py b/neon_hana/auth/permissions.py index 287cc38..c89477b 100644 --- a/neon_hana/auth/permissions.py +++ b/neon_hana/auth/permissions.py @@ -24,7 +24,8 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from dataclasses import dataclass, asdict +from dataclasses import asdict +from pydantic.dataclasses import dataclass @dataclass diff --git a/neon_hana/schema/auth_requests.py b/neon_hana/schema/auth_requests.py index d02724d..e86b7cd 100644 --- a/neon_hana/schema/auth_requests.py +++ b/neon_hana/schema/auth_requests.py @@ -65,3 +65,8 @@ class RefreshRequest(BaseModel): access_token: str refresh_token: str client_id: str + + +class PermissionsRequest(BaseModel): + access_token: str + client_id: str