
Security News
/Research
npm Phishing Email Targets Developers with Typosquatted Domain
A phishing attack targeted developers using a typosquatted npm domain (npnjs.com) to steal credentials via fake login pages - watch out for similar scams.
zmp-authentication-provider
Advanced tools
This is a library project for the authentication using the basic auth and oidc
A Python library for authentication using Basic Auth and OIDC (OpenID Connect).
This library provides authentication functionality using both Basic Authentication and OpenID Connect protocols. It's designed to be flexible and easy to integrate into your Python applications.
pip install zmp-authentication-provider
# FastAPI main.py
from zmp_authentication_provider.routes.auth import router as auth_router
from zmp_authentication_provider.service.auth_service import AuthService
@asynccontextmanager
async def lifespan(app: FastAPI):
"""Lifespan for the FastAPI app."""
try:
# 8. Initialize AIOps Service
app.state.aiops_service = AIOpsService.initialize(database=database)
logger.info("AIOps Service initialized")
yield
finally:
...
app = FastAPI(
# root_path=f"{application_settings.root_path}",
title=f"{application_settings.title}",
description=f"{application_settings.description}",
version=f"{application_settings.version}",
docs_url=f"{application_settings.docs_url}",
openapi_url=f"{application_settings.openapi_url}",
redoc_url=f"{application_settings.redoc_url}",
default_response_class=JSONResponse,
debug=True,
# servers=server,
root_path_in_servers=True,
lifespan=lifespan,
)
app.include_router(auth_router, tags=["auth"], prefix=application_settings.root_path)
# router.py
from zmp_authentication_provider.auth.oauth2_keycloak import (
TokenData,
get_current_user,
)
@router.put(
"/jobs/{job_id}",
summary="Update job details",
description="Update the details of an existing job. Only the provided fields will be updated.",
response_description="The updated job information.",
response_class=JSONResponse,
response_model=Job,
response_model_by_alias=False,
response_model_exclude_none=False,
)
async def update_job(
job_update_request: JobUpdateRequest,
job_id: str = Path(..., description="The ID of the job to update"),
service: AIOpsService = Depends(_get_aiops_service),
oauth_user: TokenData = Depends(get_current_user),
):
"""Update a job's information."""
job = Job(
id=job_id,
updated_by=oauth_user.username,
**job_update_request.model_dump(exclude_unset=True),
)
return await service.modify_job(job=job)
Put the below value into the.env
file in your project root:
# Authentication default configuration
AUTH_HTTP_CLIENT_SSL_VERIFY="True"
AUTH_APPLICATION_ENDPOINT="${AIOPS_API_ENDPOINT}"
# Keycloak configuration
KEYCLOAK_SERVER_URL="https://keycloak.ags.cloudzcp.net/auth"
KEYCLOAK_REALM="ags"
KEYCLOAK_CLIENT_ID="zmp-client"
KEYCLOAK_CLIENT_SECRET="p4W697V2t9WXSh3kCnCfSCt4MHK4myYG"
KEYCLOAK_REDIRECT_URI="${AUTH_APPLICATION_ENDPOINT}/oauth2/callback"
KEYCLOAK_ALGORITHM="RS256"
pip install pytest pytest-cov pytest-watcher pytest-asyncio certifi ruff
pip install pre-commit
The main package is located in the src/zmp_authentication_provider
directory.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the terms of the license included in the repository.
FAQs
This is a library project for the authentication using the basic auth and oidc
We found that zmp-authentication-provider demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
/Research
A phishing attack targeted developers using a typosquatted npm domain (npnjs.com) to steal credentials via fake login pages - watch out for similar scams.
Security News
Knip hits 500 releases with v5.62.0, refining TypeScript config detection and updating plugins as monthly npm downloads approach 12M.
Security News
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.