Skip to content
Snippets Groups Projects
Select Git revision
  • 3f5b9d982ad5ca646038c873ccf6f6451385cb11
  • develop default
  • master protected
  • inventoryProvider-functional
  • inventoryProvider-morework2
  • circuit-service-details-fix
  • lookup-SPECTRUM-SCHF-ports
  • inventoryProvider-1267-cleanup
  • inventoryProvider-moreWork
  • feature/DBOARD3-958
  • release/0.110
  • fix-uuid-validation-error
  • docker-poc
  • 0.160
  • 0.159
  • 0.158
  • 0.157
  • 0.156
  • 0.155
  • 0.154
  • 0.153
  • 0.152
  • 0.151
  • 0.150
  • 0.149
  • 0.148
  • 0.147
  • 0.146
  • 0.145
  • 0.144
  • 0.143
  • 0.142
  • 0.141
33 results

setup.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),
    }