Skip to content

Commit 82ef5b2

Browse files
committed
Support scopes
1 parent 4014349 commit 82ef5b2

File tree

1 file changed

+5
-4
lines changed
  • runtime/eoapi/stac/eoapi/stac

1 file changed

+5
-4
lines changed

runtime/eoapi/stac/eoapi/stac/auth.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
from typing import Annotated, Iterable, Optional
2-
from dataclasses import dataclass
1+
from typing import Annotated, Dict, Iterable, Optional
2+
from dataclasses import dataclass, field
33
from functools import cached_property
44

55
import jwt
6-
from fastapi import FastAPI, HTTPException, Security, security, status
6+
from fastapi import HTTPException, Security, security, status
77

88

99
@dataclass
@@ -14,6 +14,7 @@ class KeycloakAuth:
1414
internal_host: Optional[str] = None
1515

1616
required_audience: Optional[str | Iterable[str]] = None
17+
scopes: Dict[str, str] = field(default_factory=lambda: {})
1718

1819
def _build_url(self, host: str):
1920
return f"{host}/realms/{self.realm}/protocol/openid-connect"
@@ -69,7 +70,7 @@ def scheme(self):
6970
return security.OAuth2AuthorizationCodeBearer(
7071
authorizationUrl=f"{self.keycloak_api}/auth",
7172
tokenUrl=f"{self.keycloak_api}/token",
72-
scopes={},
73+
scopes=self.scopes,
7374
)
7475

7576
@cached_property

0 commit comments

Comments
 (0)