Skip to content

Commit aa30f7d

Browse files
committed
Breakout auth tooling into separate module
1 parent 94628bd commit aa30f7d

File tree

14 files changed

+59
-359
lines changed

14 files changed

+59
-359
lines changed

dockerfiles/Dockerfile.raster

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ RUN python -m pip install psycopg[binary,pool]
99
COPY runtimes/eoapi/raster /tmp/raster
1010
RUN python -m pip install /tmp/raster
1111
RUN rm -rf /tmp/raster
12+
COPY runtimes/eoapi/auth /tmp/auth
13+
RUN pip install /tmp/auth
14+
RUN rm -rf /tmp/auth
1215

1316
ENV MODULE_NAME eoapi.raster.app
1417
ENV VARIABLE_NAME app

dockerfiles/Dockerfile.stac

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ ENV CURL_CA_BUNDLE /etc/ssl/certs/ca-certificates.crt
77
COPY runtimes/eoapi/stac /tmp/stac
88
RUN python -m pip install /tmp/stac
99
RUN rm -rf /tmp/stac
10+
COPY runtimes/eoapi/auth /tmp/auth
11+
RUN pip install /tmp/auth
12+
RUN rm -rf /tmp/auth
1013

1114
ENV MODULE_NAME eoapi.stac.app
1215
ENV VARIABLE_NAME app

dockerfiles/Dockerfile.vector

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ FROM ghcr.io/vincentsarago/uvicorn-gunicorn:${PYTHON_VERSION}
55
COPY runtimes/eoapi/vector /tmp/vector
66
RUN python -m pip install /tmp/vector
77
RUN rm -rf /tmp/vector
8+
COPY runtimes/eoapi/auth /tmp/auth
9+
RUN pip install /tmp/auth
10+
RUN rm -rf /tmp/auth
811

912
ENV MODULE_NAME eoapi.vector.app
1013
ENV VARIABLE_NAME app

runtimes/eoapi/auth/README.md

Whitespace-only changes.

runtimes/eoapi/raster/eoapi/raster/auth.py renamed to runtimes/eoapi/auth/eoapi/auth.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
logger = logging.getLogger(__name__)
1515

1616

17+
__version__ = "0.1.0"
18+
19+
1720
class Scope(TypedDict, total=False):
1821
"""More strict version of Starlette's Scope."""
1922

runtimes/eoapi/auth/pyproject.toml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
[build-system]
2+
build-backend = "pdm.pep517.api"
3+
requires = ["pdm-pep517"]
4+
5+
[tool.pdm.version]
6+
path = "eoapi/auth.py"
7+
source = "file"
8+
9+
[tool.pdm.build]
10+
excludes = ["tests/", "**/.mypy_cache", "**/.DS_Store"]
11+
includes = ["eoapi"]
12+
13+
[project]
14+
authors = [
15+
{name = "Anthony Lukach", email = "[email protected]"},
16+
]
17+
dependencies = [
18+
"pydantic-settings>=2.2.1",
19+
"pyjwt>=2.9.0",
20+
"cryptography>=43.0.0",
21+
]
22+
description = "Authentication module for EOAPI"
23+
dynamic = ["version"]
24+
license = {text = "MIT"}
25+
name = "eoapi.auth"
26+
readme = "README.md"
27+
requires-python = ">=3.8"
28+
29+
[project.optional-dependencies]
30+
testing = [
31+
"pytest>=6.0",
32+
"coverage",
33+
]
34+
35+
[tool.setuptools]
36+
include-package-data = true
37+
py-modules = ["eoapi.auth"]
38+
39+
[tool.setuptools.packages.find]
40+
where = ["src"]

runtimes/eoapi/raster/eoapi/raster/app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import jinja2
99
import pystac
10+
from eoapi import auth
1011
from fastapi import Depends, FastAPI, Query
1112
from psycopg import OperationalError
1213
from psycopg.rows import dict_row
@@ -38,7 +39,7 @@
3839
from titiler.pgstac.reader import PgSTACReader
3940

4041
from . import __version__ as eoapi_raster_version
41-
from . import auth, config, logs
42+
from . import config, logs
4243

4344
settings = config.ApiSettings()
4445
auth_settings = auth.AuthSettings()

runtimes/eoapi/raster/pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ dependencies = [
2424
"titiler.extensions",
2525
"starlette-cramjam>=0.3,<0.4",
2626
"importlib_resources>=1.1.0;python_version<'3.9'",
27-
"pyjwt",
28-
"cryptography",
2927
]
3028

3129
[project.optional-dependencies]

runtimes/eoapi/stac/eoapi/stac/app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import logging
44
from contextlib import asynccontextmanager
55

6+
from eoapi import auth
67
from fastapi import FastAPI
78
from fastapi.responses import ORJSONResponse
89
from stac_fastapi.api.app import StacApi
@@ -34,7 +35,7 @@
3435
from starlette.templating import Jinja2Templates
3536
from starlette_cramjam.middleware import CompressionMiddleware
3637

37-
from . import auth, config, extension, logs
38+
from . import config, extension, logs
3839

3940
try:
4041
from importlib.resources import files as resources_files # type: ignore

runtimes/eoapi/stac/eoapi/stac/auth.py

Lines changed: 0 additions & 175 deletions
This file was deleted.

runtimes/eoapi/stac/pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ dependencies = [
2424
"starlette-cramjam>=0.3,<0.4",
2525
"importlib_resources>=1.1.0;python_version<'3.9'",
2626
"psycopg_pool",
27-
"pyjwt",
28-
"cryptography"
27+
"fastapi-authorization-gateway<=0.0.3"
2928
]
3029

3130
[project.optional-dependencies]

runtimes/eoapi/vector/eoapi/vector/app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from contextlib import asynccontextmanager
55

66
import jinja2
7+
from eoapi import auth
78
from fastapi import FastAPI, Request
89
from starlette.middleware.cors import CORSMiddleware
910
from starlette.templating import Jinja2Templates
@@ -16,7 +17,7 @@
1617
from tipg.settings import PostgresSettings
1718

1819
from . import __version__ as eoapi_vector_version
19-
from . import auth, config, logs
20+
from . import config, logs
2021

2122
try:
2223
from importlib.resources import files as resources_files # type: ignore

0 commit comments

Comments
 (0)