Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: remove deprecated methods and classes #126

Merged
merged 5 commits into from
Jan 3, 2025
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
40 changes: 0 additions & 40 deletions passageidentity/helper.py
Original file line number Diff line number Diff line change
@@ -1,50 +1,10 @@
"""Provides helper functions for interacting with the Passage Identity API."""

import re
from http import HTTPStatus

from requests.sessions import Request

from passageidentity import requests
from passageidentity.errors import PassageError

BEARER_PATTERN = r"Bearer ([^\s,]+)"


def extract_token(auth_header: str) -> str:
"""Extract the JWT from an Authorization header."""
expression = re.escape(BEARER_PATTERN)
match = re.search(expression, auth_header)

if match:
return match.group(1)

msg = "No Passage authorization header."
raise PassageError(msg)


def get_auth_token_from_request(request: Request, auth_strategy: int) -> str:
"""Get the auth token from a request.

Checks the Authorization header first, then the psg_auth_token cookie.
"""
if auth_strategy == 2: # noqa: PLR2004
auth_header = request.headers["Authorization"]
expression = re.escape(BEARER_PATTERN)
match = re.search(expression, auth_header)

if match:
return match.group(1)

msg = "No Passage authorization header."
raise PassageError(msg)

if "psg_auth_token" not in request.cookies:
msg = "No Passage authentication token."
raise PassageError(msg)

return request.cookies["psg_auth_token"]


def fetch_app(app_id: str) -> dict:
"""Fetch the public key for the given app id from Passage."""
Expand Down
5 changes: 0 additions & 5 deletions passageidentity/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
""" # noqa: E501

# import models into model package
from passageidentity.models.update_magic_link_auth_method import (
UpdateMagicLinkAuthMethod,
)
from passageidentity.models.update_passkey_auth_method import UpdatePasskeysAuthMethod
from passageidentity.models.update_otp_auth_method import UpdateOtpAuthMethod
from passageidentity.models.magic_link_args import (
MagicLinkArgs,
MagicLinkWithEmailArgs,
Expand Down
95 changes: 0 additions & 95 deletions passageidentity/models/update_magic_link_auth_method.py

This file was deleted.

95 changes: 0 additions & 95 deletions passageidentity/models/update_otp_auth_method.py

This file was deleted.

84 changes: 0 additions & 84 deletions passageidentity/models/update_passkey_auth_method.py

This file was deleted.

Loading
Loading