Skip to main content

A Django app for auth.

Project description

Overview

GSpot Auth is a Django app for GSpot project https://github.com/DJWOMS/GSpot

Installation

$ pip install gspot-django-auth

Quick start

  1. Add "gspot_auth" to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [
    ...
    'gspot_django_auth',
]
  1. Define these parameters in settings.py
  • REDIS_ACCESS_PREFIX
  • REDIS_ACCESS_DB
  • REDIS_HOST
  • REDIS_PORT
  • REDIS_PASSWORD
  • GET_TOKEN_FROM - 'headers' or 'cookies'
  1. Add CustomJWTAuthentication to DEFAULT_AUTHENTICATION_CLASSES in settings.py
REST_FRAMEWORK = {
    ...
    'DEFAULT_AUTHENTICATION_CLASSES': [
        'gspot_django_auth.authentication.CustomJWTAuthentication'
    ],
}
  1. Load tokens to redis for development
$ python manage.py load_test_tokens

Token and data for Admin

admin_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiaWF0IjoxNjg5NjgyNzczLCJleHAiOjE2ODk2ODMwNzN9.Q-_Lz4GmjTJuprbsKv4jSW3OGZ-ixxCmRGHva8KLkoM"
admin_data = {
    "username": "admin_username",
    "first_name": "admin_first_name",
    "last_name": "admin_last_name",
    "user_id": "7fff5488-a091-44a1-9a4e-cb9f535a7f34",
    "role": "administrator",
    "avatar": "",
    "permissions": [],
    "email": "admin@gmail.com",
    "phone": "88005553535",
    "country": None,
    "created_at": "2023-07-08 21:04:32.226941+00:00",
    "update_at": "2023-07-08 21:04:32.226953+00:00",
    "is_superuser": False,
    "is_banned": False,
    "is_active": True,
    "groups": [],
    "user_permissions": [],
    "developer_groups": [],
    "developer_permissions": []
}

Token and data for SuperUser Admin

admin_superuser_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiaWF0IjoxNjg5NjgyNzcwLCJleHAiOjE2ODk2ODMwODB9.47CONTJjEqoL6JMjyERM5WJYYA5jna55w6CXaoW55PI"
admin_superuser_token = {
    "username": "admin_username",
    "first_name": "admin_first_name",
    "last_name": "admin_last_name",
    "user_id": "7fff5488-a091-44a1-9a4e-cb9f535a7f34",
    "role": "administrator",
    "avatar": "",
    "permissions": [],
    "email": "admin@gmail.com",
    "phone": "88005553535",
    "country": None,
    "created_at": "2023-07-08 21:04:32.226941+00:00",
    "update_at": "2023-07-08 21:04:32.226953+00:00",
    "is_superuser": True,
    "is_banned": False,
    "is_active": True,
    "groups": [],
    "user_permissions": [],
    "developer_groups": [],
    "developer_permissions": []
}

Token and data for Developer

dev_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiaWF0IjoxNjg5NjgzMTI3LCJleHAiOjE2ODk2ODM0Mjd9.h-pqm9eDO9yOs2FrHIW0nPTwT45kT9rHvieYfvJoUXc"
dev_data = {
    "username": "dev_username",
    "first_name": "dev_first_name",
    "last_name": "dev_last_name",
    "user_id": "9c490b97-4423-4fae-8beb-7e0a128f469f",
    "role": "developer",
    "avatar": "",
    "permissions": [],
    "email": "developer@gmail.com",
    "phone": "88005553535",
    "country": {
        "id": 1,
        "name": "Russia"
    },
    "created_at": "2023-07-18 12:15:50.005936+00:00",
    "update_at": "2023-07-18 12:18:50.540200+00:00",
    "is_active": True,
    "is_banned": False,
    "is_superuser": False,
    "groups": [],
    "user_permissions": [],
    "company": {}
}

Token and data for Company Owner

owner_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiaWF0IjoxNjg5NjgzNTQwLCJleHAiOjE2ODk2ODM4NDB9.o8QLclmTxUOEUiVlvHyEghdjtKRbEYn9eAk_jXCswhQ"
owner_data = {
    "username": "owner_username",
    "first_name": "owner_first_name",
    "last_name": "owner_last_name",
    "user_id": "36041f78-e46a-4c62-81a6-c0c9e7cce5a4",
    "role": "developer",
    "avatar": "",
    "permissions": [],
    "email": "company_owner@gmail.com",
    "phone": "88005553535",
    "country": {
        "id": 1,
        "name": "Russia"
    },
    "created_at": "2023-07-18 12:30:50.413011+00:00",
    "update_at": "2023-07-18 12:32:17.309680+00:00",
    "is_active": True,
    "is_superuser": False,
    "is_banned": False,
    "groups": [],
    "user_permissions": [],
    "company": {
        "created_by": "9c490b97-4423-4fae-8beb-7e0a128f469f",
        "title": "Test Company",
        "description": "Test Company Description",
        "email": "test_company@gmail.com",
        "image": "",
        "is_confirmed": True,
        "is_active": True,
        "is_banned": False,
        "contact": []
    }
}

Token and data for Customer

customer_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiaWF0IjoxNjg5Njg0MDMxLCJleHAiOjE2ODk2ODQzMzF9.07kcY4cQWmw20PMf9NWrvxR7NbuVIoCmlN2Gi-hIi7A"
customer_data = {
    "username": "customer_username",
    "first_name": "customer_first_name",
    "last_name": "customer_last_name",
    "user_id": "fd3e3c48-96fc-4863-9aa8-68d1e43a6750",
    "role": "customer",
    "avatar": "",
    "permissions": [],
    "age": 18,
    "email": "customer@gmail.com",
    "phone": "88005553535",
    "created_at": "2023-07-18 12:36:56.545791+00:00",
    "update_at": "2023-07-18 12:37:13.736690+00:00",
    "friends": ["dcada25f-b104-4b12-8ac1-9364252b9e7d"],
    "birthday": "2023-07-18",
    "is_banned": False,
    "is_active": True,
    "country": {
        "id": 1,
        "name": "Russia"
    }
}

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

gspot_django_auth-0.1.5.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gspot_django_auth-0.1.5-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file gspot_django_auth-0.1.5.tar.gz.

File metadata

  • Download URL: gspot_django_auth-0.1.5.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for gspot_django_auth-0.1.5.tar.gz
Algorithm Hash digest
SHA256 5ddefaf5180fa36a1a3e6be6f6a707f510e8d4ddf2f7f5906d9c980a2b78299a
MD5 45542157d1761960c0b66df15c67a215
BLAKE2b-256 b5912481bb41e42214b63b7c178a16e4d1eadfbcb296d9fab2642cf2b9b077ea

See more details on using hashes here.

File details

Details for the file gspot_django_auth-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for gspot_django_auth-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 75eca75674bf587bcfbd72f7b87b087aa9f4795895db9c830257c2790caaa755
MD5 794d1fc9c16c074cc6c02dd4c78d0a8e
BLAKE2b-256 5abd6473389632b76a0c92d9b39c216a1878b9b091e60d12b3a9e7f7ef5448b9

See more details on using hashes here.

Supported by

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