Skip to main content

Django app for users, teamds and groups.

Project description

Pirates

Django app na uživatele, týmy a skupiny, s napojením na LDAP a SSO.

code style: Black license MIT

Použití

Settings

Přidat pirates do INSTALLED_APPS.

Modely

Jsou k dipozici abstraktní modely pro uživatele, tým a organizační skupinu. Ty lze doplnit o další fieldy specifické pro aplikaci. Příklad:

from django.db import models
from pirates.models import AbstractUser

class CustomUser(AbstractUser):
    is_friendly = models.BooleanField(default=True)

A nezapomenout model pro uživatele nastavit v settings:

AUTH_USER_MODEL = "myapp.CustomUser"

URLs

URL patterns (v současné době pouze pro OpenID Connect) jsou definovány v pirates.urls. Stačí je připojit k URL patterns projektu:

from pirates.urls import urlpatterns as pirates_urlpatterns 

urlpatterns = [
    # URL patterns projektu
    # ...
] + pirates_urlpatterns

SSO přes OpenID Connect

Implementaci OpenID zajišťuje knihovna mozilla-django-oidc.

V settings projektu je třeba nastavit několik konfiguračních konstant a autentifikační backend. Příklad settings (s využitím django-environ):

from os.path import join
import environ

env = environ.Env()

AUTHENTICATION_BACKENDS = ["pirates.auth.PiratesOIDCAuthenticationBackend"]

OIDC_RP_CLIENT_ID = env.str("OIDC_RP_CLIENT_ID")
OIDC_RP_CLIENT_SECRET = env.str("OIDC_RP_CLIENT_SECRET")
OIDC_RP_REALM_URL = env.str("OIDC_RP_REALM_URL")
OIDC_RP_SIGN_ALGO = "RS256"
OIDC_OP_JWKS_ENDPOINT = join(OIDC_RP_REALM_URL, "protocol/openid-connect/certs")
OIDC_OP_AUTHORIZATION_ENDPOINT = join(OIDC_RP_REALM_URL, "protocol/openid-connect/auth")
OIDC_OP_TOKEN_ENDPOINT = join(OIDC_RP_REALM_URL, "protocol/openid-connect/token")
OIDC_OP_USER_ENDPOINT = join(OIDC_RP_REALM_URL, "protocol/openid-connect/userinfo")

URL patterns pro OpenID Connect už jsou součástí pirates.urls (viz výše).

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

pirates-0.3.1.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

pirates-0.3.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file pirates-0.3.1.tar.gz.

File metadata

  • Download URL: pirates-0.3.1.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.0

File hashes

Hashes for pirates-0.3.1.tar.gz
Algorithm Hash digest
SHA256 4372140949787507f6518d3ab0e00c13411c9cf216ba660b0cd6dea285e80311
MD5 ea513034cd79394dd3ee907cc72c0f8c
BLAKE2b-256 f59126df49851e9e107321609d2a158604bee5ead301ad812d7add2dc34a0d9e

See more details on using hashes here.

File details

Details for the file pirates-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: pirates-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.0

File hashes

Hashes for pirates-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0df5be554fe5063b1e7c2352ed526d497f742f67e5714f4506d7a72fecf3d4aa
MD5 718faf0367c9a7695c6bf09faffd260a
BLAKE2b-256 57c720a09ced831be22f1689b491060e6f70d2880edf92a30759995645b62348

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