# Wapy.dev

## Tested Versions

- [Authelia]
  - [v4.39.0](https://github.com/authelia/authelia/releases/tag/v4.39.0)
- [Wapy.dev]
  - [v2.1.2](https://github.com/meceware/wapy.dev/releases/tag/v2.1.2)

{{% oidc-common %}}

### Assumptions

This example makes the following assumptions:

- __Application Root URL:__ `https://wapy.{{< sitevar name="domain" nojs="example.com" >}}/`
- __Authelia Root URL:__ `https://{{< sitevar name="subdomain-authelia" nojs="auth" >}}.{{< sitevar name="domain" nojs="example.com" >}}/`
- __Client ID:__ `wapy`
- __Client Secret:__ `insecure_secret`

Some of the values presented in this guide can automatically be replaced with documentation variables.

{{< sitevar-preferences >}}

## Configuration

### Authelia

The following YAML configuration is an example __Authelia__ [client configuration] for use with [Wapy.dev] which will
operate with the application example:

```yaml {title="configuration.yml"}
identity_providers:
  oidc:
    ## The other portions of the mandatory OpenID Connect 1.0 configuration go here.
    ## See: https://www.authelia.com/c/oidc
    clients:
      - client_id: 'wapy'
        client_name: 'wapydev'
        client_secret: '$pbkdf2-sha512$310000$c8p78n7pUMln0jzvd4aK4Q$JNRBzwAo0ek5qKn50cFzzvE9RXV88h1wJn5KGiHrD0YKtZaR/nCb2CJPOsKaPK0hjf.9yHxzQGZziziccp6Yng'  # The digest of 'insecure_secret'.
        sector_identifier_uri: ''
        public: false
        redirect_uris:
          - 'https://wapy.{{< sitevar name="domain" nojs="example.com" >}}/api/auth/oauth2/callback/authelia'
        audience: []
        scopes:
          - 'openid'
          - 'profile'
          - 'email'
        grant_types:
          - 'authorization_code'
        response_types:
          - 'code'
        response_modes:
          - 'form_post'
          - 'query'
          - 'fragment'
        authorization_policy: 'two_factor'
        token_endpoint_auth_method: 'client_secret_post'
```

### Application

To configure [Wapy.dev] there is one method, using the [Environment Variables](#environment-variables).

#### Environment Variables

To configure [Wapy.dev] to utilize Authelia as an [OpenID Connect 1.0] Provider, use the following environment variables:

##### Standard

```shell {title=".env"}
GENERIC_AUTH_PROVIDER=authelia
GENERIC_AUTH_ISSUER=https://{{< sitevar name="subdomain-authelia" nojs="auth" >}}.{{< sitevar name="domain" nojs="example.com" >}}/.well-known/openid-configuration
GENERIC_AUTH_CLIENT_ID=wapy
GENERIC_AUTH_CLIENT_SECRET=insecure_secret
GENERIC_AUTH_SCOPE=openid email profile
```

##### Docker Compose

```yaml {title="compose.yml"}
services:
  wapy:
    environment:
      GENERIC_AUTH_PROVIDER: 'authelia'
      GENERIC_AUTH_ISSUER: 'https://{{< sitevar name="subdomain-authelia" nojs="auth" >}}.{{< sitevar name="domain" nojs="example.com" >}}/.well-known/openid-configuration'
      GENERIC_AUTH_CLIENT_ID: 'wapy'
      GENERIC_AUTH_CLIENT_SECRET: 'insecure_secret'
      GENERIC_AUTH_SCOPE: 'openid email profile'
```

## See Also

- [Single Sign-On Alternatives Wapy.dev](https://github.com/meceware/wapy.dev/wiki/Single-Sign%E2%80%90On-(SSO)-Alternatives)

[Wapy.dev]: https://www.wapy.dev
[Authelia]: https://www.authelia.com
[OpenID Connect 1.0]: ../../introduction.md
[client configuration]: ../../../../configuration/identity-providers/openid-connect/clients.md
