Metadata-Version: 2.4
Name: django-auth-openwebauth
Version: 0.0.2
Summary: OpenWebAuth authentication
License-Expression: MIT
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Django>=6.0.4
Requires-Dist: cryptography>=48.0.0
Provides-Extra: dev
Requires-Dist: pytest-django>=4.0; extra == "dev"
Requires-Dist: django-stubs>=4.0; extra == "dev"
Dynamic: license-file

# Django authentication using OpenWebAuth 

This is a django authentication backend based on OpenWebAuth (https://codeberg.org/fediverse/fep/src/branch/main/fep/61cf/fep-61cf.md). It enables decentralised single sign-on by authenticating a remote user against a remote server.

Repository: https://codeberg.org/abanink/django_auth_openwebauth

OpenWebAuth requires that you can add the /owa endpoint on the webservice root

## Installation

```
$ pip install django-auth-openwebauth
```

## Configuration
In settings.py
- add this app to INSTALLED_APPS
    ```
    INSTALLED_APPS = [
        ...
        "django_auth_openwebauth",
        ...
    ]
- add Middlewares
    ```
    MIDDLEWARE = [
        ...
        "django_auth_openwebauth.middleware.AttemptOpenWebAuthentication",
        "django_auth_openwebauth.middleware.ValidateOpenWebAuthentication",
        ...
        "django.contrib.auth.middleware.PersistentRemoteUserMiddleware",
        ...
    ]   
    ```
- add OpenWebAuth Authentication Backend
    ```
    AUTHENTICATION_BACKENDS: tuple[str, ...] = (
        ...
        "django_auth_openwebauth.backend.OpenWebAuthBackend",
        ...
    )

In urls.py
- add this package's urls
    ```
    if "django_auth_openwebauth" in settings.INSTALLED_APPS:
        urlpatterns.append(
            path("", include("django_auth_openwebauth.urls")),
        )
    ```

### Usage

- The remote server must support OpenWebAuth
- Login on the remote server as me@remoteserver.net
- Login on your django app: https://mydjango.app/?zid=me@remoteserver.net
- You should be logged in as me@remoteserver.net and your remote avatar should be shown
