diff --git a/src/cloud/common/CloudAuth/OpenNebulaCloudAuth.rb b/src/cloud/common/CloudAuth/OpenNebulaCloudAuth.rb index f3ac62f8cd..911ec3dc86 100644 --- a/src/cloud/common/CloudAuth/OpenNebulaCloudAuth.rb +++ b/src/cloud/common/CloudAuth/OpenNebulaCloudAuth.rb @@ -14,6 +14,8 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +require 'uri' + module OpenNebulaCloudAuth # @@ -33,6 +35,17 @@ module OpenNebulaCloudAuth if auth.provided? && auth.basic? username, password = auth.credentials + if @conf[:encode_user_password] + if defined?(URI::Parser) + parser=URI::Parser.new + else + parser=URI + end + + username=parser.escape(username) + password=parser.escape(password) + end + client = OpenNebula::Client.new("#{username}:#{password}", @conf[:one_xmlrpc]) user = OpenNebula::User.new_with_id(OpenNebula::User::SELF, client) diff --git a/src/sunstone/etc/sunstone-server.conf b/src/sunstone/etc/sunstone-server.conf index ad8a4d05d1..fa848d3eb3 100644 --- a/src/sunstone/etc/sunstone-server.conf +++ b/src/sunstone/etc/sunstone-server.conf @@ -71,6 +71,11 @@ # :core_auth: cipher +# For LDAP auth. Encode credentials sent to OpenNebula. Turns espaces into %20. +# This only works with "opennebula" auth. +# +#:encode_user_password: true + ################################################################################ # UI Settings ################################################################################