Skip to content

Commit 2e0f628

Browse files
authored
new: [OIDC] OIDC_LOGIN_TEXT to customise the login button label (#422)
Add an optional OIDC_LOGIN_TEXT environment variable that sets the OidcAuth.login_button_text MISP config value, used to customise the label of the OIDC login button shown when OIDC_MIXEDAUTH is enabled. Only applied when set, so behaviour is unchanged by default. Follows the same pattern as the other OIDC_* variables in set_up_oidc(). Requires the companion MISP change that reads OidcAuth.login_button_text in app/View/Users/login.ctp (defaults to "Login with OIDC").
1 parent 4c65a72 commit 2e0f628

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

core/files/configure_misp.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,21 @@ set_up_oidc() {
121121
}" > /dev/null
122122
fi
123123

124+
# Set a custom label for the OIDC login button (shown when OIDC_MIXEDAUTH is enabled).
125+
# Enforced on every start: when unset, clear any previous value so MISP falls back to
126+
# its default ("Login with OIDC") instead of keeping a stale label.
127+
if [[ -n "${OIDC_LOGIN_TEXT}" ]]; then
128+
# JSON-encode the value so labels containing quotes/backslashes don't break the payload
129+
OIDC_LOGIN_TEXT_JSON=$(printf '%s' "${OIDC_LOGIN_TEXT}" | jq -Rs .)
130+
else
131+
OIDC_LOGIN_TEXT_JSON='""'
132+
fi
133+
sudo -u www-data php /var/www/MISP/tests/modify_config.php modify "{
134+
\"OidcAuth\": {
135+
\"login_button_text\": ${OIDC_LOGIN_TEXT_JSON}
136+
}
137+
}" > /dev/null
138+
124139
# Set the custom logout URL for OIDC if it is defined
125140
if [[ -n "${OIDC_LOGOUT_URL}" ]]; then
126141
if [[ "${OIDC_LOGOUT_URL}" == *"?"* ]]; then
@@ -149,7 +164,8 @@ set_up_oidc() {
149164
\"code_challenge_method\": \"\",
150165
\"roles_property\": \"\",
151166
\"role_mapper\": \"\",
152-
\"default_org\": \"\"
167+
\"default_org\": \"\",
168+
\"login_button_text\": \"\"
153169
}
154170
}" > /dev/null
155171

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ services:
179179
- "OIDC_ROLES_MAPPING=${OIDC_ROLES_MAPPING}"
180180
- "OIDC_DEFAULT_ORG=${OIDC_DEFAULT_ORG}"
181181
- "OIDC_MIXEDAUTH=${OIDC_MIXEDAUTH}"
182+
- "OIDC_LOGIN_TEXT=${OIDC_LOGIN_TEXT}"
182183
- "OIDC_AUTH_METHOD=${OIDC_AUTH_METHOD}"
183184
- "OIDC_REDIRECT_URI=${OIDC_REDIRECT_URI}"
184185
- "OIDC_SCOPES=${OIDC_SCOPES}"

template.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ SYNCSERVERS_1_PULL_RULES=
192192
# OIDC_ROLES_MAPPING="{\"admin\": 1}"
193193
# OIDC_DEFAULT_ORG=
194194
# OIDC_MIXEDAUTH=true
195+
# OIDC_LOGIN_TEXT="Login with OIDC"
195196
# OIDC_AUTH_METHOD="client_secret_post"
196197
# OIDC_REDIRECT_URI=
197198
# OIDC_SCOPES="[\"profile\", \"email\"]"

0 commit comments

Comments
 (0)