{"id":22657117,"url":"https://github.com/briefmnews/django-esidoc","last_synced_at":"2025-08-01T06:04:48.507Z","repository":{"id":41944563,"uuid":"183018980","full_name":"briefmnews/django-esidoc","owner":"briefmnews","description":"Handle login and ticket validation for different ENTs (Esidoc, Occitanie, HDF, ...)","archived":false,"fork":false,"pushed_at":"2025-07-22T12:18:59.000Z","size":2311,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-22T14:20:58.418Z","etag":null,"topics":["cas","django","ent","esidoc","hauts-de-france","occitanie","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/briefmnews.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-23T13:16:44.000Z","updated_at":"2025-07-22T12:19:00.000Z","dependencies_parsed_at":"2023-11-14T16:39:12.934Z","dependency_job_id":"440eacc3-5040-4624-b9e2-4e2526d8205b","html_url":"https://github.com/briefmnews/django-esidoc","commit_stats":null,"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"purl":"pkg:github/briefmnews/django-esidoc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briefmnews%2Fdjango-esidoc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briefmnews%2Fdjango-esidoc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briefmnews%2Fdjango-esidoc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briefmnews%2Fdjango-esidoc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/briefmnews","download_url":"https://codeload.github.com/briefmnews/django-esidoc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briefmnews%2Fdjango-esidoc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268177628,"owners_count":24208392,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cas","django","ent","esidoc","hauts-de-france","occitanie","python"],"created_at":"2024-12-09T10:17:38.468Z","updated_at":"2025-08-01T06:04:48.475Z","avatar_url":"https://github.com/briefmnews.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# django-esidoc\n[![Python 3.9|3.10|3.11](https://img.shields.io/badge/python-3.9|3.10|3.11-blue.svg)](https://www.python.org/downloads/release/python-3110/) \n[![Django 4.2](https://img.shields.io/badge/django-4.2-blue.svg)](https://docs.djangoproject.com/en/4.2/)\n[![Python CI](https://github.com/briefmnews/django-esidoc/actions/workflows/workflow.yaml/badge.svg)](https://github.com/briefmnews/django-esidoc/actions/workflows/workflow.yaml)\n[![codecov](https://codecov.io/gh/briefmnews/django-esidoc/branch/master/graph/badge.svg)](https://codecov.io/gh/briefmnews/django-esidoc)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/python/black)  \nHandle CAS login via sso for [e-sidoc](https://www.reseau-canope.fr/notice/e-sidoc.html). \n\n## Installation\nInstall with [pip](https://pip.pypa.io/en/stable/):\n```shell\npip install -e git://github.com/briefmnews/django-esidoc.git@master#egg=django_esidoc\n```\n\n## Setup\nIn order to make `django-esidoc` works, you'll need to follow the steps below.\n\n### Settings\nFirst you need to add the following configuration to your settings:\n```python\nINSTALLED_APPS = (\n    'django.contrib.admin',\n    'django.contrib.auth',\n    'django.contrib.sessions',\n    'django.contrib.messages',\n\n    'django_esidoc',\n    ...\n)\n\nMIDDLEWARE_CLASSES = (\n    'django.middleware.common.CommonMiddleware',\n    'django.contrib.sessions.middleware.SessionMiddleware',\n    'django.contrib.auth.middleware.AuthenticationMiddleware',\n    \n    'django_esidoc.middleware.CASMiddleware',\n    ...\n)\n\nAUTHENTICATION_BACKENDS = (\n    'django.contrib.auth.backends.ModelBackend',\n    \n    'django_esidoc.backends.CASBackend',\n    ...\n)\n```\n\n### Url\nThen you need to add the `logout` url to your `urls.py`\n```python\nurlpatterns = [\n    ...,\n    url(r'^esidoc/', include('django_esidoc.urls')),\n    ...\n]\n```\nTo logout an user, with the example above, you need to call `esidoc/logout/`. \nYou could call `django_esidoc_logout` as well.\n\n### Migrations\nNext, you need to run the migrations in order to update your database schema.\n```shell\npython manage.py migrate\n```\n\n### Mandatory settings\nHere is the list of all the mandatory settings:\n```python\nENT_ESIDOC_BASE_URL\nESIDOC_QUERY_STRING_TRIGGER\n```\n\n### Optional settings - Default redirection\nYou can set a default path redirection for inactive user by adding this line to \nyour settings:\n```python\nESIDOC_INACTIVE_USER_REDIRECT = '/{mycustompath}/'\n```\n`ESIDOC_INACTIVE_USER_REDIRECT` is used if an inactive user with a valid ticket\ntries to login.\nIf `ESIDOC_INACTIVE_USER_REDIRECT` is not set in the settings, it will take\nthe root path (i.e. `/`) as default value.\n\n\n## How to use ?\nOnce your all set up, when a request to your app is made with the query string \n`esidoc_sso_id=\u003cunique_uai\u003e`, the `CASMiddleware` catches the request and start the login process. \nHere is an example of a request url to start the login process:\n```http request\nhttps://www.exemple.com/?esidoc_sso_id=9990075c\n```\n\n## API endpoint\nIn order to expose the `Institutions` UAI number and end of subscription date, the following\nAPI endpoint is available:\n```python\nurlpatterns = [\n    ...,\n    \n    url(r\"^institutions/$\", InstitutionViewSet.as_view({'get': 'list'}), name=\"esidoc_institutions\")\n]\n```\nThis endpoint is protected by a query string token authentication named `token`. \nThe token value can be set in the settings.py of your app.\n```python\nESIDOC_ACCESS_TOKEN = 'my-secret-token-value'\n```\nNow when calling `/esidoc/insitutions/?token=my-secret-token-value`, you will get a json response\nwith all your uai numbers (`uai`) and ends of subscription (`ends_at`). Here is an example:\n```json\n[\n    {\n        \"uai\": \"9990075C\",\n        \"ends_at\": \"2020-10-05\"\n    },\n    {\n        \"uai\": \"8880075C\",\n        \"ends_at\": \"2021-09-01\"\n    }\n]\n```\n\n## Tests\nTesting is managed by `pytest`. Required package for testing can be installed with:\n```shell\npip install -r test_requirements.txt\n```\nTo run testing locally:\n```shell\npytest\n```\n\n## Credits\n- [python-cas](https://github.com/python-cas/python-cas)\n- [django-cas-ng](https://github.com/mingchen/django-cas-ng)\n\n## References\n- [CAS protocol](https://www.apereo.org/projects/cas)\n- [e-sidoc](https://www.reseau-canope.fr/notice/e-sidoc.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbriefmnews%2Fdjango-esidoc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbriefmnews%2Fdjango-esidoc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbriefmnews%2Fdjango-esidoc/lists"}