Skip to content

Commit 1fbe9fb

Browse files
committed
feat(auth): add custom user properties for audiobookshelf
Add custom user schema in LLDAP which maps to a custom attribute in Authelia which we then again map to a custom claim which we include in a custom scope which audiobookshelf requests Signed-off-by: Vegard Hagen <[email protected]>
1 parent e0fdbaf commit 1fbe9fb

File tree

4 files changed

+40
-11
lines changed

4 files changed

+40
-11
lines changed

k8s/infra/auth/authelia/values.yaml

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,15 @@ image:
77

88
pod:
99
kind: Deployment
10+
env:
11+
- name: TZ
12+
value: Europe/Oslo
1013

1114
configMap:
1215
default_2fa_method: totp
1316
theme: dark
17+
log:
18+
level: info
1419

1520
identity_validation:
1621
reset_password:
@@ -25,8 +30,7 @@ configMap:
2530
session:
2631
encryption_key: { secret_name: crypto }
2732
cookies:
28-
- subdomain: authelia
29-
domain: stonegarden.dev
33+
- domain: stonegarden.dev
3034

3135
storage:
3236
encryption_key: { secret_name: crypto }
@@ -59,6 +63,11 @@ configMap:
5963
additional_groups_dn: ou=groups
6064
user: UID=authelia,OU=people,DC=stonegarden,DC=dev
6165
password: { secret_name: lldap-auth }
66+
attributes:
67+
extra:
68+
audiobookshelf_groups:
69+
multi_valued: true
70+
value_type: string
6271

6372
identity_providers:
6473
oidc:
@@ -80,11 +89,17 @@ configMap:
8089
allowed_origins_from_client_redirect_uris: true
8190
endpoints: [ userinfo, authorization, token, revocation, introspection ]
8291
claims_policies:
92+
audiobookshelf:
93+
custom_claims:
94+
audiobookshelf: { attribute: audiobookshelf_groups }
8395
# https://www.authelia.com/integration/openid-connect/openid-connect-1.0-claims/#restore-functionality-prior-to-claims-parameter
8496
default:
85-
id_token: [ groups, email, email_verified, alt_emails, preferred_username, name ]
97+
id_token: [ email, email_verified, alt_emails, name, preferred_username, groups ]
8698
username_email:
87-
id_token: [ email, email_verified, alt_emails, preferred_username, name ]
99+
id_token: [ email, email_verified, alt_emails, name, preferred_username ]
100+
scopes:
101+
audiobookshelf:
102+
claims: [ audiobookshelf ]
88103
clients:
89104
- client_id: argocd
90105
client_secret: { path: /secrets/client-argocd/client_secret.txt }
@@ -95,7 +110,7 @@ configMap:
95110
redirect_uris:
96111
- https://argocd.stonegarden.dev/auth/callback
97112
- https://argocd.stonegarden.dev/applications
98-
scopes: [ openid, groups, email, profile, offline_access ]
113+
scopes: [ openid, email, profile, offline_access, groups ]
99114
userinfo_signed_response_alg: none
100115
id_token_signed_response_alg: ES256
101116
access_token_signed_response_alg: ES256
@@ -106,7 +121,7 @@ configMap:
106121
authorization_policy: two_factor
107122
pre_configured_consent_duration: 1 month
108123
redirect_uris: [ http://localhost:8085/auth/callback ]
109-
scopes: [ openid, groups, email, profile, offline_access ]
124+
scopes: [ openid, email, profile, offline_access, groups ]
110125
id_token_signed_response_alg: ES256
111126
access_token_signed_response_alg: ES256
112127
revocation_endpoint_auth_method: none
@@ -117,14 +132,15 @@ configMap:
117132
client_secret: { path: /secrets/client-audiobookshelf/client_secret.txt }
118133
client_name: Audiobookshelf
119134
public: false
120-
authorization_policy: two_factor
135+
authorization_policy: one_factor
136+
claims_policy: audiobookshelf
121137
pre_configured_consent_duration: 1 month
122138
require_pkce: true
123139
redirect_uris:
124140
- https://abs.stonegarden.dev/audiobookshelf/auth/openid/callback
125141
- https://abs.stonegarden.dev/audiobookshelf/auth/openid/mobile-redirect
126142
- audiobookshelf://oauth
127-
scopes: [ openid, groups, email, profile, offline_access ]
143+
scopes: [ openid, email, profile, offline_access, audiobookshelf ]
128144
id_token_signed_response_alg: ES256
129145
access_token_signed_response_alg: ES256
130146

@@ -136,7 +152,7 @@ configMap:
136152
pre_configured_consent_duration: 1 month
137153
require_pkce: true
138154
redirect_uris: [ http://localhost:8000, http://localhost:18000 ]
139-
scopes: [ openid, groups, email, profile, offline_access ]
155+
scopes: [ openid, email, profile, offline_access, groups ]
140156
revocation_endpoint_auth_method: none
141157
introspection_endpoint_auth_method: none
142158
pushed_authorization_request_endpoint_auth_method: none

k8s/infra/auth/lldap/bootstrap.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ spec:
4444
- name: groups
4545
mountPath: /bootstrap/group-configs
4646
readOnly: true
47+
- name: user-schemas
48+
mountPath: /bootstrap/user-schemas
49+
readOnly: true
4750
- name: users
4851
mountPath: /bootstrap/user-configs
4952
readOnly: true
@@ -58,6 +61,14 @@ spec:
5861
items:
5962
- key: groups.json
6063
path: groups.json
64+
- name: user-schemas
65+
projected:
66+
sources:
67+
- secret:
68+
name: lldap-config
69+
items:
70+
- key: user-schemas.json
71+
path: user-schemas.json
6172
- name: users
6273
projected:
6374
sources:

k8s/infra/auth/lldap/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ configMapGenerator:
1515
- LLDAP_LDAPS_OPTIONS__ENABLED="true"
1616
- LLDAP_LDAPS_OPTIONS__CERT_FILE="/cert/tls.crt"
1717
- LLDAP_LDAPS_OPTIONS__KEY_FILE="/cert/tls.key"
18+
- RUST_LOG=warn
1819
- name: bootstrap-env
1920
namespace: lldap
2021
literals:

k8s/infra/auth/lldap/lldap-config.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ metadata:
55
namespace: lldap
66
spec:
77
encryptedData:
8-
groups.json: AgDUmewa9DDYcF9FZbXrIS9eG/LuadHhAXrFuI6TE/ZwZxaIRo9STLGCy8m9DATOk4x0EJJur4FS8HFHCooEGM5IiSLuFWRyzGkpCW2Ef9VrmMdINDn9vQVOM2SohlQa6JiQtuU2LBWq+bKV8vCGxf/xCX2YywhYVYjAmKBzMYfELtBwODxQMJmAohNNOFlgToj7tVq3m37jlT9Yf2KvhDHnBf27/jJNWN/Ow0AWBboE06Z0aogBVQxO1o1b1lzTmvNzPaEt/ohgefJu8s8uosSQFGCzgkFcdaIb8tTv6RpHzC4BnXxBZ+kwGSwkz3ZNuAJPjGumfhP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