Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support frozen strings with REXML #728

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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 lib/onelogin/ruby-saml/authrequest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def create_params(settings, params={})
request_doc = create_authentication_xml_doc(settings)
request_doc.context[:attribute_quote] = :quote if settings.double_quote_xml_attribute_values

request = ""
request = +""
request_doc.write(request)

Logging.debug "Created AuthnRequest: #{request}"
Expand Down
2 changes: 1 addition & 1 deletion lib/onelogin/ruby-saml/logoutrequest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def create_params(settings, params={})
request_doc = create_logout_request_xml_doc(settings)
request_doc.context[:attribute_quote] = :quote if settings.double_quote_xml_attribute_values

request = ""
request = +""
request_doc.write(request)

Logging.debug "Created SLO Logout Request: #{request}"
Expand Down
2 changes: 1 addition & 1 deletion lib/onelogin/ruby-saml/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def embed_signature(meta_doc, settings)
end

def output_xml(meta_doc, pretty_print)
ret = ''
ret = +''

# pretty print the XML so IdP administrators can easily see what the SP supports
if pretty_print
Expand Down
2 changes: 1 addition & 1 deletion lib/onelogin/ruby-saml/slo_logoutresponse.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def create_params(settings, request_id = nil, logout_message = nil, params = {},
response_doc = create_logout_response_xml_doc(settings, request_id, logout_message, logout_status_code)
response_doc.context[:attribute_quote] = :quote if settings.double_quote_xml_attribute_values

response = ""
response = +""
response_doc.write(response)

Logging.debug "Created SLO Logout Response: #{response}"
Expand Down
12 changes: 10 additions & 2 deletions lib/onelogin/ruby-saml/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ class Utils
(\d+)W # 8: Weeks
)
$)x.freeze

UUID_PREFIX = '_'
@@prefix = '_'.freeze
frederikspang marked this conversation as resolved.
Show resolved Hide resolved

# Checks if the x509 cert provided is expired.
#
Expand Down Expand Up @@ -252,6 +254,8 @@ def self.verify_signature(params)
# @param status_message [Strig] StatusMessage value
# @return [String] The status error message
def self.status_error_msg(error_msg, raw_status_code = nil, status_message = nil)
error_msg = error_msg.dup

unless raw_status_code.nil?
if raw_status_code.include? "|"
status_codes = raw_status_code.split(' | ')
Expand Down Expand Up @@ -400,11 +404,15 @@ def self.retrieve_plaintext(cipher_text, symmetric_key, algorithm)
end

def self.set_prefix(value)
UUID_PREFIX.replace value
@@prefix = value
end

def self.prefix
@@prefix
end

def self.uuid
"#{UUID_PREFIX}" + (RUBY_VERSION < '1.9' ? "#{@@uuid_generator.generate}" : "#{SecureRandom.uuid}")
"#{prefix}" + (RUBY_VERSION < '1.9' ? "#{@@uuid_generator.generate}" : "#{SecureRandom.uuid}")
end

# Given two strings, attempt to match them as URIs using Rails' parse method. If they can be parsed,
Expand Down