-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DOP-21576] Update Keycloak provider for auth with Frontend (#131)
* [DOP-21576] Update Keycloak provider for auth with Frontend * [DOP-21576] Move /auth/me -> /users/me; Remove state from redirect * [DOP-21576] Small fixes * [DOP-21576] remove logout * [DOP-21576] Fix interaction schema * [DOP-21576] Update schema
- Loading branch information
Showing
10 changed files
with
180 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# SPDX-FileCopyrightText: 2024 MTS PJSC | ||
# SPDX-License-Identifier: Apache-2.0 | ||
from logging import getLogger | ||
|
||
from fastapi import APIRouter, Depends | ||
|
||
from data_rentgen.db.models.user import User | ||
from data_rentgen.server.errors.registration import get_error_responses | ||
from data_rentgen.server.schemas.v1.user import UserResponseV1 | ||
from data_rentgen.server.services import get_user | ||
|
||
logger = getLogger(__name__) | ||
|
||
|
||
router = APIRouter( | ||
prefix="/users", | ||
tags=["User"], | ||
responses=get_error_responses(), | ||
) | ||
|
||
|
||
@router.get("/me") | ||
async def check_auth( | ||
current_user: User = Depends(get_user()), | ||
) -> UserResponseV1: | ||
logger.info("User check: %s", current_user.name) | ||
return UserResponseV1.model_validate(current_user) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
# SPDX-FileCopyrightText: 2024 MTS PJSC | ||
# SPDX-License-Identifier: Apache-2.0 | ||
from data_rentgen.server.errors.schemas.invalid_request import InvalidRequestSchema | ||
from data_rentgen.server.errors.schemas.not_authorized import NotAuthorizedSchema | ||
from data_rentgen.server.errors.schemas.not_authorized import ( | ||
NotAuthorizedRedirectSchema, | ||
NotAuthorizedSchema, | ||
) | ||
from data_rentgen.server.errors.schemas.not_found import NotFoundSchema | ||
|
||
__all__ = [ | ||
"InvalidRequestSchema", | ||
"NotFoundSchema", | ||
"NotAuthorizedSchema", | ||
"NotAuthorizedRedirectSchema", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.