Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
alukach committed Apr 3, 2024
1 parent d74d8b2 commit c230257
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion runtime/eoapi/stac/eoapi/stac/auth.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
from typing import Annotated, Dict, Iterable, List, Optional, TypedDict
"""
Auth module for Keycloak integration.
"""

from functools import cached_property
from typing import Annotated, Dict, Iterable, List, Optional, TypedDict

import jwt
import pydantic
from fastapi import HTTPException, Security, security, status


class KeycloakAuth(pydantic.BaseSettings):
"""
Keycloak Integration.
"""

realm: str
host: str
client_id: str
Expand All @@ -16,6 +24,8 @@ class KeycloakAuth(pydantic.BaseSettings):
scopes: Dict[str, str] = pydantic.Field(default_factory=lambda: {})

class Config:
"""Pydantic Config"""

env_file = ".env"
env_prefix = "KEYCLOAK_"
keep_untouched = (cached_property,)
Expand Down Expand Up @@ -104,10 +114,14 @@ def jwks_client(self):


class RealmAccess(TypedDict):
"""Realm Access."""

roles: List[str]


class TokenPayload(TypedDict):
"""Parsed Keycloak JWT"""

exp: int
iat: int
auth_time: int
Expand Down

0 comments on commit c230257

Please sign in to comment.