Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/workflows/build_and_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,11 @@ jobs:
--env ROOT_PATH='/auth' \
--env EMAIL='${{ secrets.EMAIL }}' \
--env EMAIL_PASS='${{ secrets.EMAIL_PASS }}' \
--env SMTP_PASS='${{ secrets.SMTP_PASS }}' \
--env ENABLED_AUTH_METHODS='${{ vars.ENABLED_AUTH_METHODS }}' \
--env SMTP_HOST='mail.profcomff.com' \
--env SMTP_PORT='465' \
--env SMTP_HOST='${{ vars.SMTP_HOST }}' \
--env SMTP_PORT='${{ vars.SMTP_PORT }}' \
--env SMTP_LOGIN='${{ secrets.SMTP_LOGIN }}' \
--env APPLICATION_HOST='${{ vars.HOST }}' \
--env GOOGLE_REDIRECT_URL='${{ vars.GOOGLE_REDIRECT_URL }}' \
--env GOOGLE_CREDENTIALS='${{ secrets.GOOGLE_CREDENTIALS }}' \
Expand Down Expand Up @@ -190,9 +192,11 @@ jobs:
--env ROOT_PATH='/auth' \
--env EMAIL='${{ secrets.EMAIL }}' \
--env EMAIL_PASS='${{ secrets.EMAIL_PASS }}' \
--env SMTP_PASS='${{ secrets.SMTP_PASS }}' \
--env ENABLED_AUTH_METHODS='${{ vars.ENABLED_AUTH_METHODS }}' \
--env SMTP_HOST='mail.profcomff.com' \
--env SMTP_PORT='465' \
--env SMTP_HOST='${{ vars.SMTP_HOST }}' \
--env SMTP_PORT='${{ vars.SMTP_PORT }}' \
--env SMTP_LOGIN='${{ secrets.SMTP_LOGIN }}' \
--env APPLICATION_HOST='${{ vars.HOST }}' \
--env GOOGLE_REDIRECT_URL='${{ vars.GOOGLE_REDIRECT_URL }}' \
--env GOOGLE_CREDENTIALS='${{ secrets.GOOGLE_CREDENTIALS }}' \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
- uses: isort/isort-action@master
with:
requirementsFiles: "requirements.txt requirements.dev.txt"
- uses: psf/black@23.11.0
- uses: psf/black@stable
- name: Comment if linting failed
if: failure()
uses: thollander/actions-comment-pull-request@v2
Expand Down
1 change: 0 additions & 1 deletion auth_backend/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os


__version__ = os.getenv('APP_VERSION', 'dev')
1 change: 0 additions & 1 deletion auth_backend/__main__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from auth_backend.cli.process import process


if __name__ == '__main__':
process()
1 change: 0 additions & 1 deletion auth_backend/admin/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from auth_backend.settings import get_settings


settings = get_settings()


Expand Down
1 change: 0 additions & 1 deletion auth_backend/auth_method/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from .session import Session
from .userdata_mixin import UserdataMixin


__all__ = [
"Session",
"AUTH_METHODS",
Expand Down
1 change: 0 additions & 1 deletion auth_backend/auth_method/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from auth_backend.models.db import AuthMethod, User, UserSession
from auth_backend.settings import get_settings


logger = logging.getLogger(__name__)
settings = get_settings()

Expand Down
1 change: 0 additions & 1 deletion auth_backend/auth_method/oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from .method_mixins import LoginableMixin, RegistrableMixin
from .userdata_mixin import UserdataMixin


logger = logging.getLogger(__name__)


Expand Down
1 change: 0 additions & 1 deletion auth_backend/auth_method/outer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from auth_backend.models.db import AuthMethod, UserSession
from auth_backend.utils.security import UnionAuth


logger = logging.getLogger(__name__)


Expand Down
1 change: 0 additions & 1 deletion auth_backend/auth_plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from .vk import VkAuth
from .yandex import YandexAuth


__all__ = [
"AUTH_METHODS",
"AuthPluginMeta",
Expand Down
1 change: 0 additions & 1 deletion auth_backend/auth_plugins/airflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from auth_backend.auth_method.outer import ConnectionIssue, OuterAuthMeta
from auth_backend.settings import Settings


logger = logging.getLogger(__name__)


Expand Down
1 change: 0 additions & 1 deletion auth_backend/auth_plugins/authentic.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from auth_backend.settings import Settings
from auth_backend.utils.security import UnionAuth


AUTH_METHOD_ID_PARAM_NAME = 'user_id'
logger = logging.getLogger(__name__)

Expand Down
1 change: 0 additions & 1 deletion auth_backend/auth_plugins/coder.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from auth_backend.auth_method.outer import ConnectionIssue, OuterAuthMeta
from auth_backend.settings import Settings


logger = logging.getLogger(__name__)


Expand Down
1 change: 0 additions & 1 deletion auth_backend/auth_plugins/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from auth_backend.utils.smtp import SendEmailMessage
from auth_backend.utils.string import random_string


settings = get_settings()
logger = logging.getLogger(__name__)

Expand Down
1 change: 0 additions & 1 deletion auth_backend/auth_plugins/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from auth_backend.settings import Settings
from auth_backend.utils.security import UnionAuth


logger = logging.getLogger(__name__)


Expand Down
1 change: 0 additions & 1 deletion auth_backend/auth_plugins/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from auth_backend.settings import Settings
from auth_backend.utils.security import UnionAuth


logger = logging.getLogger(__name__)


Expand Down
1 change: 0 additions & 1 deletion auth_backend/auth_plugins/keycloak.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from auth_backend.settings import Settings
from auth_backend.utils.security import UnionAuth


logger = logging.getLogger(__name__)


Expand Down
1 change: 0 additions & 1 deletion auth_backend/auth_plugins/lkmsu.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from auth_backend.utils.security import UnionAuth
from auth_backend.utils.string import concantenate_strings


logger = logging.getLogger(__name__)


Expand Down
1 change: 0 additions & 1 deletion auth_backend/auth_plugins/mailu.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from auth_backend.auth_method.outer import ConnectionIssue, OuterAuthMeta
from auth_backend.settings import Settings


logger = logging.getLogger(__name__)


Expand Down
1 change: 0 additions & 1 deletion auth_backend/auth_plugins/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from auth_backend.auth_method import OuterAuthMeta
from auth_backend.settings import Settings


logger = logging.getLogger(__name__)


Expand Down
1 change: 0 additions & 1 deletion auth_backend/auth_plugins/telegram.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from auth_backend.utils.security import UnionAuth
from auth_backend.utils.string import concantenate_strings


logger = logging.getLogger(__name__)


Expand Down
1 change: 0 additions & 1 deletion auth_backend/auth_plugins/vk.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

from ..schemas.types.scopes import Scope


logger = logging.getLogger(__name__)


Expand Down
1 change: 0 additions & 1 deletion auth_backend/auth_plugins/yandex.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from auth_backend.utils.security import UnionAuth
from auth_backend.utils.string import concantenate_strings


logger = logging.getLogger(__name__)


Expand Down
1 change: 0 additions & 1 deletion auth_backend/cli/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from .user import create_user
from .user_group import create_user_group


settings = get_settings()
engine = create_engine(str(settings.DB_DSN))
Session = sessionmaker(bind=engine)
Expand Down
1 change: 0 additions & 1 deletion auth_backend/kafka/kafka.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from auth_backend.kafka.kafkameta import KafkaMeta
from auth_backend.settings import get_settings


log = logging.getLogger(__name__)


Expand Down
1 change: 0 additions & 1 deletion auth_backend/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
from .db import AuthMethod, User, UserSession
from .dynamic_settings import DynamicOption


__all__ = ["Base", "User", "UserSession", "AuthMethod", "DynamicOption"]
1 change: 0 additions & 1 deletion auth_backend/models/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from auth_backend.settings import get_settings
from auth_backend.utils.user_session_basics import session_expires_date


settings = get_settings()
logger = logging.getLogger(__name__)

Expand Down
1 change: 0 additions & 1 deletion auth_backend/routes/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from . import exc_handlers
from .base import app


__all__ = ["app", "exc_handlers"]
1 change: 0 additions & 1 deletion auth_backend/routes/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from auth_backend.schemas.models import Group, GroupGet, GroupPatch, GroupPost, GroupsGet
from auth_backend.utils.security import UnionAuth


groups = APIRouter(prefix="/group", tags=["Groups"])


Expand Down
1 change: 0 additions & 1 deletion auth_backend/routes/oidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from auth_backend.utils.jwt import create_jwks
from auth_backend.utils.oidc_token import OidcGrantType, token_by_client_credentials, token_by_refresh_token


settings = get_settings()
router = APIRouter(prefix="/openid", tags=["OpenID"])
logger = logging.getLogger(__name__)
Expand Down
1 change: 0 additions & 1 deletion auth_backend/routes/scopes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from auth_backend.schemas.models import ScopeGet, ScopePatch, ScopePost
from auth_backend.utils.security import UnionAuth


scopes = APIRouter(prefix="/scope", tags=["Scopes"])


Expand Down
1 change: 0 additions & 1 deletion auth_backend/routes/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
)
from auth_backend.utils.security import UnionAuth


logger = logging.getLogger(__name__)
user = APIRouter(prefix="/user", tags=["User"])

Expand Down
1 change: 0 additions & 1 deletion auth_backend/routes/user_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
from auth_backend.utils import user_session_control
from auth_backend.utils.security import UnionAuth


user_session = APIRouter(prefix="", tags=["User session"])
logger = logging.getLogger(__name__)

Expand Down
2 changes: 2 additions & 0 deletions auth_backend/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ class Settings(BaseSettings):
EMAIL: str | None = None
APPLICATION_HOST: str = "localhost"
EMAIL_PASS: str | None = None
SMTP_PASS: str | None = None
SMTP_HOST: str = 'smtp.gmail.com'
SMTP_PORT: int = 587
SMTP_LOGIN: str | None = None
ENABLED_AUTH_METHODS: list[str] | None = None
TOKEN_LENGTH: Annotated[int, Gt(8)] = 64
SESSION_TIME_IN_DAYS: int = 30
Expand Down
1 change: 0 additions & 1 deletion auth_backend/utils/jwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

from auth_backend.settings import get_settings


settings = get_settings()


Expand Down
1 change: 0 additions & 1 deletion auth_backend/utils/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from auth_backend.utils.user_session_basics import session_expires_date
from auth_backend.utils.user_session_control import SESSION_UPDATE_SCOPE


settings = get_settings()


Expand Down
6 changes: 3 additions & 3 deletions auth_backend/utils/smtp.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from auth_backend.models.db import UserMessageDelay
from auth_backend.settings import Settings, get_settings


logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -115,8 +114,9 @@ def email_task(cls, to_email: str, file_name: str, subject: str, **kwargs):
text = MIMEText(tmp, "html")
msgAlternative.attach(text)

with smtplib.SMTP_SSL(cls.settings.SMTP_HOST, 465) as smtp:
smtp.login(cls.settings.EMAIL, cls.settings.EMAIL_PASS)
with smtplib.SMTP(cls.settings.SMTP_HOST, cls.settings.SMTP_PORT) as smtp:
smtp.starttls()
smtp.login(cls.settings.SMTP_LOGIN, cls.settings.SMTP_PASS)
smtp.sendmail(cls.settings.EMAIL, to_email, message.as_string())

@classmethod
Expand Down
1 change: 0 additions & 1 deletion auth_backend/utils/user_session_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from auth_backend.settings import get_settings


settings = get_settings()


Expand Down
1 change: 0 additions & 1 deletion auth_backend/utils/user_session_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from auth_backend.utils.string import random_string
from auth_backend.utils.user_session_basics import session_expires_date


SESSION_UPDATE_SCOPE = 'auth.session.update'

settings = get_settings()
Expand Down
1 change: 0 additions & 1 deletion migrations/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from auth_backend.models.base import Base
from auth_backend.settings import get_settings


# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
Expand Down
1 change: 0 additions & 1 deletion migrations/versions/2d29fc132e89_fix_base_users_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

from auth_backend.models.db import Group, User


# revision identifiers, used by Alembic.
revision = '2d29fc132e89'
down_revision = 'dcb89e72d446'
Expand Down
1 change: 0 additions & 1 deletion migrations/versions/586cf0e784e5_scopes.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import sqlalchemy as sa
from alembic import op


# revision identifiers, used by Alembic.
revision = '586cf0e784e5'
down_revision = 'b07c0ca33c2b'
Expand Down
1 change: 0 additions & 1 deletion migrations/versions/5d71a2a2405d_verified_user_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import sqlalchemy as sa
from alembic import op


# revision identifiers, used by Alembic.
revision = '5d71a2a2405d'
down_revision = '2d29fc132e89'
Expand Down
1 change: 0 additions & 1 deletion migrations/versions/6c27352ee53b_unique_scopes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from alembic import op


revision = '6c27352ee53b'
down_revision = '586cf0e784e5'
branch_labels = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import sqlalchemy as sa
from alembic import op


# revision identifiers, used by Alembic.
revision = '6dffd8e42152'
down_revision = '2d29fc132e89'
Expand Down
1 change: 0 additions & 1 deletion migrations/versions/7c1cd7ceacd8_dynamic_option_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

from auth_backend.models.db import Group, Scope, User


# revision identifiers, used by Alembic.
revision = '7c1cd7ceacd8'
down_revision = 'bda218c91211'
Expand Down
Loading
Loading