Skip to main content

This is an app for managing authnetication in a SaaS product named Platform.

Project description

# Integrating Platform Authentication Module

Step 1: Install the Platform Authentication Module

pip install platform-authentication

Step 2: Add to Installed Apps

Update your project's INSTALLED_APPS setting in settings.py:

INSTALLED_APPS = [
    # ...,
    'platform_authentication',
]

Step 3: Configure Middleware and Create Custom Middleware

Create a new file middleware.py in your project and add the following code:

from platform_authentication.middleware import JWTMiddleware

# Project-Specific Imports

# Relative Import

class CustomJWTMiddleware(JWTMiddleware):
    def _is_excluded_endpoint(self, endpoint):
        """Helper method to check if an endpoint is excluded from subscription checks."""
        pass
        # Your logic for checking if the endpoint is excluded from authentication check

Now, add the custom middleware to your project's middleware in settings.py:

MIDDLEWARE = [
    # ...,
    'your_path_to.custom_middleware.CustomJWTMiddleware',
    # ...,
]

Step 4: Fake Migrations

Run the following command to fake migrations for the platform_authentication app:

python manage.py migrate platform_authentication --fake

Step 5: Secret Key Replacement

Replace the secret key in your child project with the secret key from platform-authentication. Keep the secret key secure.

# Example:
# parent_project_secret_key = '<some_secret_key1>'

# child_project_secret_key = '<parent_project_secret_key>'

Note: Ensure to replace placeholder values (<some_secret_key1>, <parent_project_secret_key>) with your actual secret keys.

Configuration

To configure the authentication settings for your project, you can use the following settings in your Django project's settings.py file:

SIMPLE_JWT = {
    'AUTH_HEADER_TYPES': ('JWT', "Bearer",),
    'USER_ID_FIELD': 'username',
}

Now, your Django project is integrated with the platform_authentication module for streamlined user authentication.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

platform_authentication-0.0.5.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

platform_authentication-0.0.5-py3-none-any.whl (28.2 kB view details)

Uploaded Python 3

File details

Details for the file platform_authentication-0.0.5.tar.gz.

File metadata

File hashes

Hashes for platform_authentication-0.0.5.tar.gz
Algorithm Hash digest
SHA256 12e51161ce334d50dca95ab1d1c436fe6d4ceb2eecb890ca0592853130fab089
MD5 932fb18b2ceefc7bb5996358eff03d18
BLAKE2b-256 64d485d9172698f315fb50650aadbbf8e3dc9f35156f5365aff65d440ac13f6e

See more details on using hashes here.

File details

Details for the file platform_authentication-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for platform_authentication-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d47a802535cc529bf25ac7e9272679422f9b41377a3682d2df2c3222ddd6ea7e
MD5 5f126f0f96e52798211f7cc83f875077
BLAKE2b-256 e51e27565694aaf59bf31272c0b8df2f3216919a9b46aafda6bcf9cae5fc55c4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page