django-hub-sdk


Namedjango-hub-sdk JSON
Version 0.1.15 PyPI version JSON
download
home_pagehttps://github.com/bildvitta/django-hub-sdk
SummaryThe ISS (International Space Station) aims to be a space station (client) of connection between the microservices of its ecosystem and the authentication and permissions microservice of the user that here is called in the script as Hub.permissions modules / microservices (Hub)
upload_time2023-09-08 17:07:37
maintainer
docs_urlNone
authorGuilherme Haynes Howe
requires_python>=3.10,<4.0
licenseMIT
keywords django hub bildvitta
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # django-hub-sdk

![PyPI](https://img.shields.io/pypi/v/django-hub-sdk)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-hub-sdk)
[![Django Hub SDK](https://github.com/bildvitta/django-hub-sdk/actions/workflows/main.yml/badge.svg)](https://github.com/bildvitta/django-hub-sdk/actions/workflows/main.yml)

## What Is This?

The ISS (International Space Station) aims to be a space station (client) of connection between the microservices of its
ecosystem and the authentication and permissions microservice of the user that here is called in the script as
Hub.permissions modules / microservices (Hub)

## How To Use This

### Installation

```shell
pip install django-hub-sdk
```

or if you are using Pipenv or Poetry

```shell
pipenv install django-hub-sdk
```

```shell
poetry add django-hub-sdk
```

### Settings

Add the app to installed apps

```python
INSTALLED_APPS = [
    ...,
    "django_hub_sdk",
    ...,
]
```

All settings can be modified through environment variables, so if you are using `.env` please use it.

**Mandatory Settings**

```python
import os 

HUB_APP_SLUG = "" # project name on the hub

HUB_BASE_URI = os.environ.get("HUB_BASE_URI", "") # HUB backend url
HUB_BASE_FRONT_URI = os.environ.get(
    "HUB_BASE_FRONT_URI", "" # HUB frontend url
)

HUB_PROGRAMMATIC_CLIENT = os.environ.get("HUB_PROGRAMMATIC_CLIENT", "") # Programmatic user access public key
HUB_PROGRAMMATIC_SECRET = os.environ.get("HUB_PROGRAMMATIC_SECRET", "") # Programmatic user access private key

HUB_OAUTH_CLIENT_ID = os.environ.get("HUB_OAUTH_CLIENT_ID", "") # Public oauth access key
HUB_OAUTH_CLIENT_SECRET = os.environ.get("HUB_OAUTH_CLIENT_SECRET", "") # Private oauth access key
HUB_OAUTH_REDIRECT = os.environ.get("HUB_OAUTH_REDIRECT", "") # oauth access return URL
```

### User Model

To continue the installation, in your User model extend the class below to be able to create the necessary relationships with the HUB

```python
from django.contrib.auth.models import AbstractUser

from django_hub_sdk.models import BaseHubUser # <- Import BaseHubUser


# Create your models here.
class User(AbstractUser, BaseHubUser): # <- Extends this on model
    ...
```

### Urls

Add this line to your urls.py to work with the frontend SDK

```python
from django.urls import path, include

urlpatterns = [
    path("api/", include("django_hub_sdk.urls", namespace="django_hub_sdk"))
]
```

## Use of Authorization

Use of authorizations to use the JWT generated by the Hub

```python
from django_hub_sdk.authentication import HubJWTAuthentication # Import from package

from rest_framework import views

class LogoutView(views.APIView):
    authentication_classes = [HubJWTAuthentication] # <- Use on authentication_classes
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/bildvitta/django-hub-sdk",
    "name": "django-hub-sdk",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10,<4.0",
    "maintainer_email": "",
    "keywords": "django,hub,bildvitta",
    "author": "Guilherme Haynes Howe",
    "author_email": "zerossb@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d8/e4/993c4153cc4cb2fba51b6b0fbea4b095b6d9abd512320b7fb43a3bb78e42/django_hub_sdk-0.1.15.tar.gz",
    "platform": null,
    "description": "# django-hub-sdk\n\n![PyPI](https://img.shields.io/pypi/v/django-hub-sdk)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-hub-sdk)\n[![Django Hub SDK](https://github.com/bildvitta/django-hub-sdk/actions/workflows/main.yml/badge.svg)](https://github.com/bildvitta/django-hub-sdk/actions/workflows/main.yml)\n\n## What Is This?\n\nThe ISS (International Space Station) aims to be a space station (client) of connection between the microservices of its\necosystem and the authentication and permissions microservice of the user that here is called in the script as\nHub.permissions modules / microservices (Hub)\n\n## How To Use This\n\n### Installation\n\n```shell\npip install django-hub-sdk\n```\n\nor if you are using Pipenv or Poetry\n\n```shell\npipenv install django-hub-sdk\n```\n\n```shell\npoetry add django-hub-sdk\n```\n\n### Settings\n\nAdd the app to installed apps\n\n```python\nINSTALLED_APPS = [\n    ...,\n    \"django_hub_sdk\",\n    ...,\n]\n```\n\nAll settings can be modified through environment variables, so if you are using `.env` please use it.\n\n**Mandatory Settings**\n\n```python\nimport os \n\nHUB_APP_SLUG = \"\" # project name on the hub\n\nHUB_BASE_URI = os.environ.get(\"HUB_BASE_URI\", \"\") # HUB backend url\nHUB_BASE_FRONT_URI = os.environ.get(\n    \"HUB_BASE_FRONT_URI\", \"\" # HUB frontend url\n)\n\nHUB_PROGRAMMATIC_CLIENT = os.environ.get(\"HUB_PROGRAMMATIC_CLIENT\", \"\") # Programmatic user access public key\nHUB_PROGRAMMATIC_SECRET = os.environ.get(\"HUB_PROGRAMMATIC_SECRET\", \"\") # Programmatic user access private key\n\nHUB_OAUTH_CLIENT_ID = os.environ.get(\"HUB_OAUTH_CLIENT_ID\", \"\") # Public oauth access key\nHUB_OAUTH_CLIENT_SECRET = os.environ.get(\"HUB_OAUTH_CLIENT_SECRET\", \"\") # Private oauth access key\nHUB_OAUTH_REDIRECT = os.environ.get(\"HUB_OAUTH_REDIRECT\", \"\") # oauth access return URL\n```\n\n### User Model\n\nTo continue the installation, in your User model extend the class below to be able to create the necessary relationships with the HUB\n\n```python\nfrom django.contrib.auth.models import AbstractUser\n\nfrom django_hub_sdk.models import BaseHubUser # <- Import BaseHubUser\n\n\n# Create your models here.\nclass User(AbstractUser, BaseHubUser): # <- Extends this on model\n    ...\n```\n\n### Urls\n\nAdd this line to your urls.py to work with the frontend SDK\n\n```python\nfrom django.urls import path, include\n\nurlpatterns = [\n    path(\"api/\", include(\"django_hub_sdk.urls\", namespace=\"django_hub_sdk\"))\n]\n```\n\n## Use of Authorization\n\nUse of authorizations to use the JWT generated by the Hub\n\n```python\nfrom django_hub_sdk.authentication import HubJWTAuthentication # Import from package\n\nfrom rest_framework import views\n\nclass LogoutView(views.APIView):\n    authentication_classes = [HubJWTAuthentication] # <- Use on authentication_classes\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "The ISS (International Space Station) aims to be a space station (client) of connection between the microservices of its ecosystem and the authentication and permissions microservice of the user that here is called in the script as Hub.permissions modules / microservices (Hub)",
    "version": "0.1.15",
    "project_urls": {
        "Homepage": "https://github.com/bildvitta/django-hub-sdk",
        "Repository": "https://github.com/bildvitta/django-hub-sdk"
    },
    "split_keywords": [
        "django",
        "hub",
        "bildvitta"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "130e0135c51cbd28a6f011b2792b1a4d3b0760cfbd30c9f08678ca4933799bc2",
                "md5": "85309b16be90352ef894156baa76a450",
                "sha256": "5bca6b62531e7bbfafdcf89e48965d433d2a667866b82449b02971e3455db7bb"
            },
            "downloads": -1,
            "filename": "django_hub_sdk-0.1.15-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "85309b16be90352ef894156baa76a450",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<4.0",
            "size": 12198,
            "upload_time": "2023-09-08T17:07:35",
            "upload_time_iso_8601": "2023-09-08T17:07:35.205036Z",
            "url": "https://files.pythonhosted.org/packages/13/0e/0135c51cbd28a6f011b2792b1a4d3b0760cfbd30c9f08678ca4933799bc2/django_hub_sdk-0.1.15-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d8e4993c4153cc4cb2fba51b6b0fbea4b095b6d9abd512320b7fb43a3bb78e42",
                "md5": "07a11ca35b860bd1b66f906c61522191",
                "sha256": "c3f7a62ac34e50173a957d20cd635a3a7bb6b339ace33f1a3381b07e746babe1"
            },
            "downloads": -1,
            "filename": "django_hub_sdk-0.1.15.tar.gz",
            "has_sig": false,
            "md5_digest": "07a11ca35b860bd1b66f906c61522191",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<4.0",
            "size": 8384,
            "upload_time": "2023-09-08T17:07:37",
            "upload_time_iso_8601": "2023-09-08T17:07:37.066109Z",
            "url": "https://files.pythonhosted.org/packages/d8/e4/993c4153cc4cb2fba51b6b0fbea4b095b6d9abd512320b7fb43a3bb78e42/django_hub_sdk-0.1.15.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-08 17:07:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bildvitta",
    "github_project": "django-hub-sdk",
    "github_not_found": true,
    "lcname": "django-hub-sdk"
}
        
Elapsed time: 0.15280s