Expose 'username' via forward auth headers

This commit is contained in:
Dan Milne
2026-01-05 15:12:02 +11:00
parent ba08158c85
commit 27d77ebf47
3 changed files with 9 additions and 3 deletions

View File

@@ -76,6 +76,7 @@ class Application < ApplicationRecord
user: "X-Remote-User",
email: "X-Remote-Email",
name: "X-Remote-Name",
username: "X-Remote-Username",
groups: "X-Remote-Groups",
admin: "X-Remote-Admin"
}.freeze
@@ -195,6 +196,8 @@ class Application < ApplicationRecord
headers[header_name] = user.email_address
when :name
headers[header_name] = user.name.presence || user.email_address
when :username
headers[header_name] = user.username if user.username.present?
when :groups
headers[header_name] = user.groups.pluck(:name).join(",") if user.groups.any?
when :admin