Name | django-hub-sdk JSON |
Version |
0.1.20
JSON |
| download |
home_page | https://github.com/bildvitta/django-hub-sdk |
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) |
upload_time | 2024-07-04 02:51:16 |
maintainer | None |
docs_url | None |
author | Guilherme Haynes Howe |
requires_python | <4.0,>=3.10 |
license | MIT |
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": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "django, hub, bildvitta",
"author": "Guilherme Haynes Howe",
"author_email": "zerossb@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/0a/dc/a510fcb5083a1eca2febfa6e3c9deadcf073c7dbecbf8ab71ba5ba36f32f/django_hub_sdk-0.1.20.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.20",
"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": "20d0bff0b16bf94f6f4cee533b404bdd36191c63e0747581e139b6a0acea028c",
"md5": "5ddbddde7f9178132a281343f8bf9048",
"sha256": "84dbbebb03121d7ae9fa79979a92c66c3f82db912488b115959a5d08835e6da0"
},
"downloads": -1,
"filename": "django_hub_sdk-0.1.20-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5ddbddde7f9178132a281343f8bf9048",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 12220,
"upload_time": "2024-07-04T02:51:15",
"upload_time_iso_8601": "2024-07-04T02:51:15.057056Z",
"url": "https://files.pythonhosted.org/packages/20/d0/bff0b16bf94f6f4cee533b404bdd36191c63e0747581e139b6a0acea028c/django_hub_sdk-0.1.20-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0adca510fcb5083a1eca2febfa6e3c9deadcf073c7dbecbf8ab71ba5ba36f32f",
"md5": "3fe58f4a88d1bc0e61242c28ae496daa",
"sha256": "704edd7a639038d90995583cb6731473797d89f5f6e03f187e56ed8b4e02c993"
},
"downloads": -1,
"filename": "django_hub_sdk-0.1.20.tar.gz",
"has_sig": false,
"md5_digest": "3fe58f4a88d1bc0e61242c28ae496daa",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 8406,
"upload_time": "2024-07-04T02:51:16",
"upload_time_iso_8601": "2024-07-04T02:51:16.916283Z",
"url": "https://files.pythonhosted.org/packages/0a/dc/a510fcb5083a1eca2febfa6e3c9deadcf073c7dbecbf8ab71ba5ba36f32f/django_hub_sdk-0.1.20.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-04 02:51:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "bildvitta",
"github_project": "django-hub-sdk",
"github_not_found": true,
"lcname": "django-hub-sdk"
}