Add Authelia OAuth2 login to HedgeDoc.

This commit is contained in:
Viyurz 2024-05-11 10:53:19 +02:00
parent c0f8721a00
commit ac0e5936b6
Signed by: Viyurz
SSH key fingerprint: SHA256:IskOHTmhHSJIvAt04N6aaxd5SZCVWW1Guf9tEcxIMj8
3 changed files with 31 additions and 2 deletions

View file

@ -76,6 +76,16 @@ identity_providers:
- key: | - key: |
{{ authelia_secrets["jwks_key"] | indent(width=10) }} {{ authelia_secrets["jwks_key"] | indent(width=10) }}
clients: clients:
- client_id: '{{ authelia_secrets["hedgedoc_client_id"] }}'
client_name: HedgeDoc
client_secret: '{{ authelia_secrets["hedgedoc_client_secret_hash"] }}'
redirect_uris: 'https://hedgedoc.{{ domain }}/auth/oauth2/callback'
scopes:
- 'openid'
- 'profile'
- 'email'
token_endpoint_auth_method: client_secret_post
- client_id: '{{ synapse_secrets["oidc_client_id"] }}' - client_id: '{{ synapse_secrets["oidc_client_id"] }}'
client_name: Synapse client_name: Synapse
client_secret: '{{ synapse_secrets["oidc_client_secret_hash"] }}' client_secret: '{{ synapse_secrets["oidc_client_secret_hash"] }}'

View file

@ -6,3 +6,14 @@ CMD_DB_PASSWORD='{{ hedgedoc_secrets["postgres_password"] }}'
CMD_DOMAIN='hedgedoc.{{ domain }}' CMD_DOMAIN='hedgedoc.{{ domain }}'
CMD_PROTOCOL_USESSL=true CMD_PROTOCOL_USESSL=true
CMD_SESSION_SECRET='{{ hedgedoc_secrets["session_secret"] }}' CMD_SESSION_SECRET='{{ hedgedoc_secrets["session_secret"] }}'
CMD_OAUTH2_PROVIDERNAME=Authelia
CMD_OAUTH2_CLIENT_ID='{{ authelia_secrets["hedgedoc_client_id"] }}'
CMD_OAUTH2_CLIENT_SECRET='{{ authelia_secrets["hedgedoc_client_secret"] }}'
CMD_OAUTH2_AUTHORIZATION_URL=https://auth.{{ domain }}/api/oidc/authorization
CMD_OAUTH2_TOKEN_URL=https://auth.{{ domain }}/api/oidc/token
CMD_OAUTH2_USER_PROFILE_URL=https://auth.{{ domain }}/api/oidc/userinfo
CMD_OAUTH2_SCOPE=openid email profile
CMD_OAUTH2_USER_PROFILE_USERNAME_ATTR=preferred_username
CMD_OAUTH2_USER_PROFILE_DISPLAY_NAME_ATTR=name
CMD_OAUTH2_USER_PROFILE_EMAIL_ATTR=email

View file

@ -12,14 +12,24 @@ cifs_credentials:
authelia_secrets: authelia_secrets:
# Encryption key for the database, must be saved # Encryption key for the database, must be saved
encryption_key: encryption_key:
# Generate random client id : docker run --rm authelia/authelia:4 authelia crypto rand --length 72 --charset rfc3986
# Generate random secret + hash : docker run --rm authelia/authelia:4 authelia crypto hash generate pbkdf2 --variant sha512 --random --random.length 72 --random.charset rfc3986
hedgedoc_client_id:
hedgedoc_client_secret:
hedgedoc_client_secret_hash:
hmac_secret: hmac_secret:
jwks_key: | # openssl genrsa 4096 jwks_key: | # openssl genrsa 4096
jwt_secret: jwt_secret:
# LDAP bind dn # LDAP bind dn
ldap_user: ldap_user:
ldap_password: ldap_password:
postgres_user: postgres_user:
postgres_password: postgres_password:
smtp_user: smtp_user:
smtp_password: smtp_password:
@ -51,9 +61,7 @@ searxng_secrets:
searxng_secret: searxng_secret:
synapse_secrets: synapse_secrets:
# docker run --rm authelia/authelia:4 authelia crypto rand --length 72 --charset rfc3986
oidc_client_id: oidc_client_id:
# Generate random secret + hash : docker run --rm authelia/authelia:4 authelia crypto hash generate pbkdf2 --variant sha512 --random --random.length 72 --random.charset rfc3986
oidc_client_secret: oidc_client_secret:
oidc_client_secret_hash: oidc_client_secret_hash:
smtp_user: smtp_user: