django-casdoor-auth


Namedjango-casdoor-auth JSON
Version 1.1.0 PyPI version JSON
download
home_pagehttps://github.com/casdoor/django-auth-sso
SummaryAn app for use Casdoor SSO
upload_time2023-07-25 01:55:47
maintainer
docs_urlNone
authorleo220yuyaodog
requires_python>=3.6
licenseApache 2.0
keywords casdoor django
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # django-casdoor-auth

[![GitHub Action](https://github.com/casdoor/django-casdoor-auth/workflows/build/badge.svg?branch=master)](https://github.com/casdoor/django-casdoor-auth/actions)
[![Version](https://img.shields.io/pypi/v/django-casdoor-auth.svg)](https://pypi.org/project/django-casdoor-auth/)
[![PyPI - Wheel](https://img.shields.io/pypi/wheel/django-casdoor-auth.svg)](https://pypi.org/project/django-casdoor-auth/)
[![Pyversions](https://img.shields.io/pypi/pyversions/django-casdoor-auth.svg)](https://pypi.org/project/django-casdoor-auth/)
[![Discord](https://img.shields.io/discord/1022748306096537660?logo=discord&label=discord&color=5865F2)](https://discord.gg/5rPsrAzK7S)

Casdoor's SDK for Django will allow you to easily connect your application to the Casdoor authentication system without having to implement it from scratch.

## Step1. install app

django-casdoor-auth is available on PyPI:

```shell
pip install django-casdoor-auth
```

casdoor-auth is simple to use. We will show you the steps below.
## Step2. Config
setting.py

Add "casdoor_auth" in INSTALLED_APPS
```python
INSTALLED_APPS = [
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    "casdoor_auth"
]
```

Initialization requires 6 parameters, which are all str type:

| Name (in order)  | Must | Description                                         |
| ---------------- | ---- | --------------------------------------------------- |
| endpoint         | Yes  | Casdoor Server Url, such as `http://localhost:8000` |
| client_id         | Yes  | Application.client_id                               |
| client_secret     | Yes  | Application.client_secret                           |
| certificate       | Yes  | The public key for the Casdoor application's cert   |
| org_name | Yes  | Application.organization                                    |
| application_name | Yes | Application.name |

```python
CASDOOR_CONFIG = {
    'endpoint': 'http://localhost:8000',
    'client_id': '<client-id>',
    'client_secret': '<client-secret>',
    'certificate': '''<certificate>''',
    'org_name': 'built-in',
    'application_name': 'app-built-in'
}
```

The redirect url, is the URL that your APP is configured to listen to the response from Casdoor.
```python
REDIRECT_URI = 'http://127.0.0.1:8000/casdoor/callback/'
```
The login redirect url, after login successfully, you will jump to this page.
```python
LOGIN_REDIRECT_URL = '/'
```
## Step3. router
urls.py

```python
urlpatterns = [
    ...
    path('casdoor/', include('casdoor_auth.urls')),
    ...
]
```
The casdoor_auth provider two functions for using Casdoor.
```python
urlpatterns = [
    path('login/', views.toLogin, name='casdoor_sso'),
    path('callback/', views.callback, name='callback'),
]
```
To add a button for using the Casdoor login,  for example:
```html
<button><a href="{% url 'casdoor_sso' %}">casdoor</a></button>`
```



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/casdoor/django-auth-sso",
    "name": "django-casdoor-auth",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "Casdoor Django",
    "author": "leo220yuyaodog",
    "author_email": "magicwindyyd@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/72/a9/488ec36db927817fc3a661c55dc9080320327ab7b12dbc4ab8322c34aef6/django-casdoor-auth-1.1.0.tar.gz",
    "platform": "any",
    "description": "# django-casdoor-auth\n\n[![GitHub Action](https://github.com/casdoor/django-casdoor-auth/workflows/build/badge.svg?branch=master)](https://github.com/casdoor/django-casdoor-auth/actions)\n[![Version](https://img.shields.io/pypi/v/django-casdoor-auth.svg)](https://pypi.org/project/django-casdoor-auth/)\n[![PyPI - Wheel](https://img.shields.io/pypi/wheel/django-casdoor-auth.svg)](https://pypi.org/project/django-casdoor-auth/)\n[![Pyversions](https://img.shields.io/pypi/pyversions/django-casdoor-auth.svg)](https://pypi.org/project/django-casdoor-auth/)\n[![Discord](https://img.shields.io/discord/1022748306096537660?logo=discord&label=discord&color=5865F2)](https://discord.gg/5rPsrAzK7S)\n\nCasdoor's SDK for Django will allow you to easily connect your application to the Casdoor authentication system without having to implement it from scratch.\n\n## Step1. install app\n\ndjango-casdoor-auth is available on PyPI:\n\n```shell\npip install django-casdoor-auth\n```\n\ncasdoor-auth is simple to use. We will show you the steps below.\n## Step2. Config\nsetting.py\n\nAdd \"casdoor_auth\" in INSTALLED_APPS\n```python\nINSTALLED_APPS = [\n    \"django.contrib.admin\",\n    \"django.contrib.auth\",\n    \"django.contrib.contenttypes\",\n    \"django.contrib.sessions\",\n    \"django.contrib.messages\",\n    \"django.contrib.staticfiles\",\n    \"casdoor_auth\"\n]\n```\n\nInitialization requires 6 parameters, which are all str type:\n\n| Name (in order)  | Must | Description                                         |\n| ---------------- | ---- | --------------------------------------------------- |\n| endpoint         | Yes  | Casdoor Server Url, such as `http://localhost:8000` |\n| client_id         | Yes  | Application.client_id                               |\n| client_secret     | Yes  | Application.client_secret                           |\n| certificate       | Yes  | The public key for the Casdoor application's cert   |\n| org_name | Yes  | Application.organization                                    |\n| application_name | Yes | Application.name |\n\n```python\nCASDOOR_CONFIG = {\n    'endpoint': 'http://localhost:8000',\n    'client_id': '<client-id>',\n    'client_secret': '<client-secret>',\n    'certificate': '''<certificate>''',\n    'org_name': 'built-in',\n    'application_name': 'app-built-in'\n}\n```\n\nThe redirect url, is the URL that your APP is configured to listen to the response from Casdoor.\n```python\nREDIRECT_URI = 'http://127.0.0.1:8000/casdoor/callback/'\n```\nThe login redirect url, after login successfully, you will jump to this page.\n```python\nLOGIN_REDIRECT_URL = '/'\n```\n## Step3. router\nurls.py\n\n```python\nurlpatterns = [\n    ...\n    path('casdoor/', include('casdoor_auth.urls')),\n    ...\n]\n```\nThe casdoor_auth provider two functions for using Casdoor.\n```python\nurlpatterns = [\n    path('login/', views.toLogin, name='casdoor_sso'),\n    path('callback/', views.callback, name='callback'),\n]\n```\nTo add a button for using the Casdoor login,  for example:\n```html\n<button><a href=\"{% url 'casdoor_sso' %}\">casdoor</a></button>`\n```\n\n\n",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "An app for use Casdoor SSO",
    "version": "1.1.0",
    "project_urls": {
        "Homepage": "https://github.com/casdoor/django-auth-sso"
    },
    "split_keywords": [
        "casdoor",
        "django"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "52c96c49ab3953ae7e951444f52cf4cf9bcb537ebb26ee939e36f3503b5f9390",
                "md5": "0b411b0b7c5125a1bbfc8de80408e234",
                "sha256": "5b13f3a6484616b43633c78701dd410be118c53fb89cc505be0ef0353bf45acc"
            },
            "downloads": -1,
            "filename": "django_casdoor_auth-1.1.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0b411b0b7c5125a1bbfc8de80408e234",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.6",
            "size": 10762,
            "upload_time": "2023-07-25T01:55:45",
            "upload_time_iso_8601": "2023-07-25T01:55:45.771554Z",
            "url": "https://files.pythonhosted.org/packages/52/c9/6c49ab3953ae7e951444f52cf4cf9bcb537ebb26ee939e36f3503b5f9390/django_casdoor_auth-1.1.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "72a9488ec36db927817fc3a661c55dc9080320327ab7b12dbc4ab8322c34aef6",
                "md5": "cf4abdeb561e3e9c3189bf078c357046",
                "sha256": "87f7a5a88fedb997b4f078bce9f48650b68ac106582697f2a193cc08f59b0f88"
            },
            "downloads": -1,
            "filename": "django-casdoor-auth-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "cf4abdeb561e3e9c3189bf078c357046",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 7598,
            "upload_time": "2023-07-25T01:55:47",
            "upload_time_iso_8601": "2023-07-25T01:55:47.261610Z",
            "url": "https://files.pythonhosted.org/packages/72/a9/488ec36db927817fc3a661c55dc9080320327ab7b12dbc4ab8322c34aef6/django-casdoor-auth-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-25 01:55:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "casdoor",
    "github_project": "django-auth-sso",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "django-casdoor-auth"
}
        
Elapsed time: 0.09220s