Skip to content

Commit

Permalink
Allow setting a tenant header on successful login
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Jul 1, 2024
1 parent c6f2d9d commit e17d8ce
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions schemas/sogis-mysoch-auth.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@
"userid_verify_sql": {
"description": "Query which verifies whether the userid exist. Must contain the :id placeholder",
"type": "string"
},
"tenant_header_name": {
"description": "Name of tenant header to set when redirecting on successfull mysoch-auth",
"type": "string"
},
"tenant_header_value": {
"description": "Value of tenant header to set when redirecting on successfull mysoch-auth",
"type": "string"
}
},
"required": [
Expand Down
5 changes: 5 additions & 0 deletions src/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ def login():
}
access_token = create_access_token(identity=identity)
resp = make_response(redirect(target_url))
tenant_header_name = config.get("tenant_header_name", "")
tenant_header_value = config.get("tenant_header_value", "")
if tenant_header_name:
app.logger.debug("Setting header %s=%s" % (tenant_header_name, tenant_header_value))
resp.headers[tenant_header_name] = tenant_header_value
set_access_cookies(resp, access_token)
return resp
else:
Expand Down

0 comments on commit e17d8ce

Please sign in to comment.