Skip to content
Snippets Groups Projects
Select Git revision
  • 9bd76b12c0e307ba83ecfd8ed91d6f03e3314c02
  • develop default protected
  • master protected
  • authorship-fix-from-develop
  • 1048-service-config-backfilling
  • feature/nat-1211-edgeport-lacp-xmit
  • fix/nat-1120-sdp-validation
  • NAT-1154-import-edge-port-update
  • fix/l3-imports
  • feature/10GGBS-NAT-980
  • fix/NAT-1009/fix-redeploy-base-config-if-there-is-a-vprn
  • 4.24
  • 4.23
  • 4.22
  • 4.21
  • 4.20
  • 4.19
  • 4.18
  • 4.17
  • 4.16
  • 4.15
  • 4.14
  • 4.13
  • 4.12
  • 4.11
  • 4.10
  • 4.8
  • 4.5
  • 4.4
  • 4.3
  • 4.2
31 results

monkeypatches.py

Blame
  • monkeypatches.py 1.09 KiB
    """Override certain classes and settings in the oauth2_lib.fastapi package with custom implementations.
    
    This adjustment is typically done to extend or modify the functionality of the original
    oauth2_lib package to meet specific requirements of the gso application.
    """
    
    from datetime import datetime
    from ipaddress import IPv4Address, IPv6Address
    
    import oauth2_lib.fastapi
    import oauth2_lib.settings
    from pydantic import BaseModel
    
    from gso.auth.oidc_policy_helper import HTTPX_SSL_CONTEXT, OIDCUser, OIDCUserModel, opa_decision
    from gso.auth.settings import oauth2lib_settings
    
    oauth2_lib.fastapi.OIDCUser = OIDCUser  # type: ignore[assignment, misc]
    oauth2_lib.fastapi.OIDCUserModel = OIDCUserModel  # type: ignore[assignment, misc]
    oauth2_lib.fastapi.opa_decision = opa_decision  # type: ignore[assignment]
    oauth2_lib.fastapi.HTTPX_SSL_CONTEXT = HTTPX_SSL_CONTEXT
    oauth2_lib.settings.oauth2lib_settings = oauth2lib_settings  # type: ignore[assignment]
    
    BaseModel.model_config["json_encoders"] = {
        datetime: lambda dt: dt.timestamp(),
        IPv4Address: lambda v: str(v),
        IPv6Address: lambda v: str(v),
    }