generated from EOEPCA/um-service-template
-
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.
* Fix develop dockerfile * Change keycloak urls * Fix develop workflow tag * Fix production workflow * Change log message * Change config * Add health check * Fix health check * Add ready health endpoint * Fix issue * Change workflow filenames * Eoepca 910 um keycloak develop an identity api based on keycloak api (#17) * feat: policies endpoints added, not completely * feat: working on update policies * feat: all remaining added, still policy update not working, create and update scope based permission not working * feat: last resource permissions endpoints added and working * fix: changed pyyaml version from 5.4.1 to 5.3.1 * feat: endpoints changed * Update README * Update config * Update config * Update config * Api testing (#18) * feat: added client_id as param to enpoints and other fixes * added changes for permissions endpoints * Update ci * Update ci * Release v1.0.0 * Fix ci * Fix requirements * Fix ci * Upgrade flask version * Update requirements * feat: added error handling (#23) * feat: added validator of register and protect resource enpoint to test * feat: register and protect resources endpoint working * feat: added delete resources, policies and permissions * Update ci * Update ci * Fix ci * Add options method to endpoints * feat: added endpoint to create client, add resources and protect them if provided * Revert "Add options method to endpoints" This reverts commit 9d8c034. * fea: commit fixes * feat: more fixes, some endpoint were dounbled * fix: last fix * Update ci * fix: policies fix, response now return client id and resources created * feat: create client default to confidential and authorization enabled * Convert to FastAPI * Convert to FastAPI * changes to models * Remove file * Add error handling, pydantic models, files restructuring * Fix issues * Handle keycloak error message * added fildes to models and descriptions * Add authenticated field * Clean and reformat * Point to keycloak client 1.0.0 * Change logging * Fix readme * Clean * Change logging * Clean * merge to develop * added default resource to response list * Create default resource * Fix policies issue * Improvements * Change keycloak client to v1.0.0 * Clarify readme * Add log file * Fix gitignore * Fix dockerfile * Change logging * Change settings to pydantic * Clean and reformat --------- Co-authored-by: flaviorosadme <[email protected]> Co-authored-by: flaviorosadme <[email protected]>
- Loading branch information
1 parent
5b768a5
commit c536119
Showing
10 changed files
with
60 additions
and
83 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
* | ||
!app | ||
!requirements.* | ||
!config.ini | ||
!um-identity-api.log | ||
!.env |
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,6 @@ | ||
LOG_LEVEL=INFO | ||
AUTH_SERVER_URL=http://localhost | ||
ADMIN_USERNAME=admin | ||
ADMIN_PASSWORD=admin | ||
REALM=master | ||
VERSION=v1.0.0 |
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 |
---|---|---|
|
@@ -53,8 +53,6 @@ cover/ | |
# PyBuilder | ||
target/ | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
|
||
|
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 |
---|---|---|
@@ -1,8 +1,24 @@ | ||
import os | ||
from typing import Mapping | ||
from functools import lru_cache | ||
|
||
from identityutils.configuration import load_configuration | ||
from pydantic_settings import BaseSettings, SettingsConfigDict | ||
|
||
config: Mapping[str, str] = ( | ||
load_configuration(os.path.join(os.path.dirname(__file__), "../config.ini")) | ||
) | ||
|
||
class Settings(BaseSettings): | ||
model_config = SettingsConfigDict(env_file=".env") | ||
|
||
# Keycloak | ||
auth_server_url: str = "http://localhost" | ||
admin_username: str = "admin" | ||
admin_password: str = "admin" | ||
realm: str = "master" | ||
|
||
# Swagger | ||
version: str = "v1.0.0" | ||
|
||
# Logging | ||
log_level: str = "INFO" | ||
|
||
|
||
@lru_cache | ||
def get_settings(): | ||
return Settings() |
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 |
---|---|---|
@@ -1,61 +1,30 @@ | ||
import logging | ||
|
||
from logging.config import dictConfig | ||
from pydantic import BaseModel | ||
|
||
from app.configuration import config | ||
|
||
|
||
|
||
class LogConfig(BaseModel): | ||
"""Logging configuration to be set for the server""" | ||
|
||
LOGGER_NAME: str = "mycoolapp" | ||
LOG_FORMAT: str = "%(levelprefix)s | %(asctime)s | %(message)s" | ||
level = config.get("App", "logging_level") | ||
if not level: | ||
level = 'INFO' | ||
LOG_LEVEL: str = level.upper() | ||
from app.configuration import get_settings | ||
|
||
# Logging config | ||
version = 1 | ||
disable_existing_loggers = False | ||
formatters = { | ||
settings = get_settings() | ||
logging_config = { | ||
"version": 1, | ||
"disable_existing_loggers": False, | ||
"formatters": { | ||
"default": { | ||
"()": "uvicorn.logging.DefaultFormatter", | ||
"fmt": LOG_FORMAT, | ||
"fmt": "%(levelprefix)s | %(asctime)s | %(message)s", | ||
"datefmt": "%Y-%m-%d %H:%M:%S", | ||
|
||
}, | ||
} | ||
handlers = { | ||
}, | ||
"handlers": { | ||
"default": { | ||
"formatter": "default", | ||
"class": "logging.StreamHandler", | ||
"stream": "ext://sys.stderr", | ||
}, | ||
} | ||
loggers = { | ||
LOGGER_NAME: {"handlers": ["default"], "level": LOG_LEVEL}, | ||
} | ||
|
||
def get_logging_level(): | ||
level = config.get("App", "logging_level") | ||
if not level: | ||
level = 'info' | ||
level = level.lower() | ||
if level == 'critical' or level == 'critical': | ||
return logging.CRITICAL | ||
if level == 'error': | ||
return logging.ERROR | ||
if level == 'warning' or level == 'warn': | ||
return logging.WARNING | ||
if level == 'info': | ||
return logging.INFO | ||
if level == 'debug': | ||
return logging.DEBUG | ||
if level == 'notset': | ||
return logging.NOTSET | ||
|
||
|
||
dictConfig(LogConfig().model_dump()) | ||
}, | ||
"loggers": { | ||
"um-identity-api": {"handlers": ["default"], "level": settings.log_level.upper()}, | ||
}, | ||
} | ||
dictConfig(logging_config) | ||
logger = logging.getLogger("um-identity-api") |
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -6,4 +6,5 @@ configparser==6.0.0 | |
retry==0.9.2 | ||
urllib3==2.0.7 | ||
pydantic==2.5.0 | ||
pydantic-settings==2.1.0 | ||
identityutils @ git+https://github.com/eoepca/[email protected] |