Skip to content
This repository was archived by the owner on Aug 29, 2018. It is now read-only.

Commit a7feb39

Browse files
author
Abhishek Gupta
committed
Make the error message on user lookup configurable
1 parent aeb7a2b commit a7feb39

File tree

5 files changed

+11
-3
lines changed

5 files changed

+11
-3
lines changed

broker/conf/broker.conf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,14 @@ APP_ADVERTISE_HTTPS="false"
142142
# Set to true to block new user creation within OpenShift broker
143143
# If set to true, only allows existing users to access OpenShift
144144
# New users, even if authenticated, will not be provisioned in OpenShift broker
145-
# and will get an AccessDeniedException
145+
# and will get an error message
146146
AUTH_USER_LOOKUP_ONLY="false"
147147

148+
# The error message that is displayed to users logging in with valid credentials
149+
# but who do not have an account provisioned in the cluster already
150+
AUTH_USER_LOOKUP_FAIL_MESSAGE="This cluster is configured for user lookup only. Please contact your system administrator for provisioning your user account."
151+
152+
148153
# Team collaboration settings
149154
MAX_MEMBERS_PER_RESOURCE="100"
150155
MAX_TEAMS_PER_RESOURCE="5"

broker/config/environments/development.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
:limit_app_name_chars => conf.get("LIMIT_APP_NAME_CHARS", -1).to_i,
123123
:app_advertise_https => conf.get_bool("APP_ADVERTISE_HTTPS", false),
124124
:auth_user_lookup_only => conf.get_bool("AUTH_USER_LOOKUP_ONLY", false),
125+
:auth_user_lookup_fail_msg => conf.get("AUTH_USER_LOOKUP_FAIL_MESSAGE", "This cluster is configured for user lookup only. Please contact your system administrator for provisioning your user account."),
125126
}
126127

127128
config.auth = {

broker/config/environments/production.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
:limit_app_name_chars => conf.get("LIMIT_APP_NAME_CHARS", -1).to_i,
112112
:app_advertise_https => conf.get_bool("APP_ADVERTISE_HTTPS", false),
113113
:auth_user_lookup_only => conf.get_bool("AUTH_USER_LOOKUP_ONLY", false),
114+
:auth_user_lookup_fail_msg => conf.get("AUTH_USER_LOOKUP_FAIL_MESSAGE", "This cluster is configured for user lookup only. Please contact your system administrator for provisioning your user account."),
114115
}
115116

116117
config.auth = {

broker/config/environments/test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@
120120
:limit_app_name_chars => conf.get("LIMIT_APP_NAME_CHARS", -1).to_i,
121121
:app_advertise_https => conf.get_bool("APP_ADVERTISE_HTTPS", false),
122122
:auth_user_lookup_only => conf.get_bool("AUTH_USER_LOOKUP_ONLY", false),
123+
:auth_user_lookup_fail_msg => conf.get("AUTH_USER_LOOKUP_FAIL_MESSAGE", "This cluster is configured for user lookup only. Please contact your system administrator for provisioning your user account."),
123124
}
124125

125126
config.auth = {

controller/app/models/cloud_user.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,9 @@ def self.find_or_create_by_identity(provider, login, create_attributes={}, &bloc
163163
yield user, login if block_given?
164164
[user, false]
165165
rescue Mongoid::Errors::DocumentNotFound
166-
# if new user creation is blocked, then return an exception
166+
# if authentication is configured for lookup only, then return an exception
167167
if Rails.application.config.openshift[:auth_user_lookup_only]
168-
raise OpenShift::UserException.new("New user signups are not allowed on this cluster")
168+
raise OpenShift::UserException.new(Rails.application.config.openshift[:auth_user_lookup_fail_msg])
169169
end
170170
user = new(create_attributes)
171171
#user.current_identity = user.identities.build(provider: provider, uid: login)

0 commit comments

Comments
 (0)