Skip to content

Commit

Permalink
added project and fixed flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanmcreynolds committed Oct 11, 2023
1 parent ce6e10f commit 8d3f690
Show file tree
Hide file tree
Showing 13 changed files with 249 additions and 133 deletions.
13 changes: 13 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[flake8]
exclude =
.git,
__pycache__,
build,
dist,
versioneer.py,
tiled/_version.py,
tiled/serialization/_zipfile_py39.py,
docs/source/conf.py,
share,
web-frontend,
max-line-length = 115
1 change: 0 additions & 1 deletion .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,3 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,4 @@ api_keys.yml
users.yml

splash_flows_globus/
splash_auth/
splash_auth/
29 changes: 29 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-ast
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
- id: debug-statements

- repo: https://github.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8

- repo: https://github.com/timothycrosley/isort
rev: 5.12.0
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 22.8.0
hooks:
- id: black
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Project Name

## Description

[Insert project description here]

## Installation

[Insert installation instructions here]

## Usage

[Insert usage instructions here]

## Contributing

[Insert contributing guidelines here]

## License

[Insert license information here]
3 changes: 1 addition & 2 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ build:
@podman build -t ${TAG} . --platform=linux/amd64
@echo "tagging to: " ${TAG} ${REGISTRY_TAG}
@podman tag ${TAG} ${REGISTRY_TAG}

push:
@echo "Pushing " ${REGISTRY_TAG}
@podman push ${REGISTRY_TAG}

38 changes: 38 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "splash_auth"
description = "Authenticating proxy with oidc and api_key support"
readme = { file = "README.md", content-type = "text/markdown" }

requires-python = ">=3.11"



classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.11"
]

dependencies = [
"fastapi>=0.68.0,<0.69.0",
"uvicorn>=0.15.0,<0.16.0",
"python-jose",
"httpx==0.23.3",
"pyyaml"

]

dynamic = ["version"]


[tool.hatch]
version.source = "vcs"
build.hooks.vcs.version-file = "server/_version.py"

[tool.hatch.metadata]
allow-direct-references = true
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fastapi>=0.68.0,<0.69.0
pydantic>=1.8.0,<2.0.0
# pydantic>=1.8.0,<2.0.0
uvicorn>=0.15.0,<0.16.0
python-jose
httpx==0.23.3
pyyaml
pyyaml
16 changes: 16 additions & 0 deletions server/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# file generated by setuptools_scm
# don't change, don't track in version control
TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import Tuple, Union
VERSION_TUPLE = Tuple[Union[int, str], ...]
else:
VERSION_TUPLE = object

version: str
__version__: str
__version_tuple__: VERSION_TUPLE
version_tuple: VERSION_TUPLE

__version__ = version = '0.1.11.dev1+gce6e10f.d20231011'
__version_tuple__ = version_tuple = (0, 1, 11, 'dev1', 'gce6e10f.d20231011')
28 changes: 16 additions & 12 deletions server/config.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,38 @@
import os
import logging
import os

logger = logging.getLogger("splash_auth.config")



JWT_SECRET = os.environ["JWT_SECRET"]
TOKEN_TIME = int(os.environ["TOKEN_EXP_TIME"])
OAUTH_AUTH_ENDPOINT=os.environ["OAUTH_AUTH_ENDPOINT"]
OAUTH_AUTH_ENDPOINT = os.environ["OAUTH_AUTH_ENDPOINT"]
OAUTH_CLIENT_ID = os.environ["OAUTH_CLIENT_ID"]
OAUTH_CLIENT_SECRET = os.environ["OAUTH_CLIENT_SECRET"]
OAUTH_REDIRECT_URI = os.environ["OAUTH_REDIRECT_URI"]
OAUTH_TOKEN_URI = os.environ["OAUTH_TOKEN_URI"] # can be found at https://accounts.google.com/.well-known/openid-configuration
OAUTH_TOKEN_URI = os.environ[
"OAUTH_TOKEN_URI"
] # can be found at https://accounts.google.com/.well-known/openid-configuration
OUATH_SUCCESS_REDIRECT_URI = os.environ["OUATH_SUCCESS_REDIRECT_URI"]
OUATH_FAIL_REDIRECT_URI = os.environ["OUATH_FAIL_REDIRECT_URI"]
OUATH_JWKS_URI = os.environ["OUATH_JWKS_URI"]
HTTP_CLIENT_MAX_CONNECTIONS = os.getenv("HTTP_CLIENT_MAX_CONNECTIONS", 100)
HTTP_CLIENT_TIMEOUT_ALL= os.getenv("HTTP_CLIENT_TIMEOUT_ALL", 5.0)
HTTP_CLIENT_TIMEOUT_ALL = os.getenv("HTTP_CLIENT_TIMEOUT_ALL", 5.0)
HTTP_CLIENT_TIMEOUT_CONNECT = os.getenv("HTTP_CLIENT_TIMEOUT_CONNECT", 3.0)
HTTP_CLIENT_TIMEOUT_POOL = os.getenv("HTTP_CLIENT_TIMEOUT_POOL", 10)



google_claims = {'iss': 'https://accounts.google.com',
'azp': OAUTH_CLIENT_ID,
'aud': OAUTH_CLIENT_ID
google_claims = {
"iss": "https://accounts.google.com",
"azp": OAUTH_CLIENT_ID,
"aud": OAUTH_CLIENT_ID,
}

logger.info(f"JWT_SECRET {JWT_SECRET}")
logger.info(f"TOKEN_TIME {TOKEN_TIME}")
logger.info(f"OAUTH_AUTH_ENDPOINT {OAUTH_AUTH_ENDPOINT}")
logger.info(f"OAUTH_CLIENT_ID {OAUTH_CLIENT_ID}")
logger.info(f"OAUTH_CLIENT_SECRET is a secret")
logger.info("OAUTH_CLIENT_SECRET is a secret")
logger.info(f"OAUTH_REDIRECT_URI {OAUTH_REDIRECT_URI}")
logger.info(f"OAUTH_TOKEN_URI {OAUTH_TOKEN_URI}")
logger.info(f"OUATH_SUCCESS_REDIRECT_URI {OUATH_SUCCESS_REDIRECT_URI}")
Expand All @@ -41,7 +42,9 @@
logger.info(f"HTTP_CLIENT_TIMEOUT_ALL {HTTP_CLIENT_TIMEOUT_ALL}")
logger.info(f"HTTP_CLIENT_TIMEOUT_CONNECT {HTTP_CLIENT_TIMEOUT_CONNECT}")
logger.info(f"HTTP_CLIENT_TIMEOUT_POOL {HTTP_CLIENT_TIMEOUT_POOL}")
class Config():


class Config:
jwt_secret = JWT_SECRET
token_time = TOKEN_TIME
oauth_endpoint = OAUTH_AUTH_ENDPOINT
Expand All @@ -58,4 +61,5 @@ class Config():
http_client_timeout_connect = HTTP_CLIENT_TIMEOUT_CONNECT
http_client_timeout_pool = HTTP_CLIENT_TIMEOUT_POOL

config = Config()

config = Config()
Loading

0 comments on commit 8d3f690

Please sign in to comment.