diff --git a/roles/authelia-for-tandoor/defaults/main.json b/roles/authelia-for-tandoor/defaults/main.json new file mode 100644 index 0000000..ac1e5c6 --- /dev/null +++ b/roles/authelia-for-tandoor/defaults/main.json @@ -0,0 +1,5 @@ +{ + "var_authelia_for_tandoor_tandoor_url_base": "https://tandoor.example.org", + "var_authelia_for_tandoor_client_id": "tandoor", + "var_authelia_for_tandoor_client_secret": "REPLACE_ME" +} diff --git a/roles/authelia-for-tandoor/info.md b/roles/authelia-for-tandoor/info.md new file mode 100644 index 0000000..5b61b6b --- /dev/null +++ b/roles/authelia-for-tandoor/info.md @@ -0,0 +1,9 @@ +## Beschreibung + +Um [Tandoor](../tandoor) gegen [Authelia](../authelia) authentifizieren zu lassen + + +## Verweise + +- [allauth | OpenID Connect](https://docs.allauth.org/en/latest/socialaccount/providers/openid_connect.html) +- [Tandoor-Dokumentation | Configuration Example for Authelia](https://docs.tandoor.dev/features/authentication/#configuration-example-for-authelia) diff --git a/roles/authelia-for-tandoor/tasks/main.json b/roles/authelia-for-tandoor/tasks/main.json new file mode 100644 index 0000000..0b83858 --- /dev/null +++ b/roles/authelia-for-tandoor/tasks/main.json @@ -0,0 +1,33 @@ +[ + { + "name": "configuration | compute client secret hash", + "become": true, + "ansible.builtin.shell": { + "cmd": "authelia crypto hash generate bcrypt --password {{var_authelia_for_tandoor_client_secret}} | cut --delimiter=' ' --fields='2-'" + }, + "register": "temp_authelia_for_tandoor_client_secret_hashed" + }, + { + "name": "configuration | emplace", + "become": true, + "ansible.builtin.template": { + "src": "authelia-client-conf.json.j2", + "dest": "/etc/authelia/conf.d/clients/tandoor.json" + } + }, + { + "name": "configuration | apply", + "become": true, + "ansible.builtin.command": { + "cmd": "/usr/bin/authelia-conf-compose" + } + }, + { + "name": "restart service", + "become": true, + "ansible.builtin.systemd_service": { + "state": "restarted", + "name": "authelia" + } + } +] diff --git a/roles/authelia-for-tandoor/templates/authelia-client-conf.json.j2 b/roles/authelia-for-tandoor/templates/authelia-client-conf.json.j2 new file mode 100644 index 0000000..7a2137e --- /dev/null +++ b/roles/authelia-for-tandoor/templates/authelia-client-conf.json.j2 @@ -0,0 +1,17 @@ +{ + "client_id": "{{var_authelia_for_tandoor_client_id}}", + "client_secret": "{{temp_authelia_for_tandoor_client_secret_hashed.stdout}}", + "client_name": "Tandoor", + "public": false, + "authorization_policy": "one_factor", + "redirect_uris": [ + "{{var_authelia_for_tandoor_tandoor_url_base}}/accounts/oidc/authelia/login/callback/" + ], + "scopes": [ + "openid", + "email", + "profile" + ], + "userinfo_signed_response_alg": "none", + "token_endpoint_auth_method": "client_secret_basic" +}