Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/src/app/config.clj
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
[:oidc-roles-attr {:optional true} :string]
[:oidc-email-attr {:optional true} :string]
[:oidc-name-attr {:optional true} :string]
[:smb-name {:optional false} :string]
[:default-email-domain {:optional true} :string]

[:ldap-attrs-email {:optional true} :string]
[:ldap-attrs-fullname {:optional true} :string]
Expand Down
8 changes: 4 additions & 4 deletions backend/src/app/http/auth_request.clj
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@

(defn- resolve-email
"If the claim is already a valid email, return it as-is.
Otherwise treat it as a bare username and append @<smb-name>.com."
Otherwise treat it as a bare username and append @<default-email-domain>."
[email-claim]
(if (valid-email? email-claim)
email-claim
(let [domain (cf/get :smb-name)]
(l/wrn :hint "x-auth-request: email claim is not a valid address, constructing from smb-name"
(let [domain (or (cf/get :default-email-domain) "askii.ai")]
(l/wrn :hint "x-auth-request: email claim is not a valid address, constructing from default-email-domain"
:claim email-claim
:domain domain)
(str (first (str/split email-claim #"@")) "@" domain ".com"))))
(str (first (str/split email-claim #"@")) "@" domain))))

(defn- get-or-register-profile
"Looks up a profile by email. If not found and the
Expand Down
2 changes: 1 addition & 1 deletion backend/test/backend_tests/helpers.clj
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
:redis-uri "redis://redis/1"
:auto-file-snapshot-every 1
:file-data-backend "db"
:smb-name "testcorp"})
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default value should be testcorp in tests.

:default-email-domain "askii.ai"})

(def config
(cf/read-config :prefix "penpot-test"
Expand Down
Loading