Skip to content

Commit

Permalink
Adjust from review
Browse files Browse the repository at this point in the history
  • Loading branch information
frederikspang committed Jan 9, 2025
1 parent fe69a45 commit 6c51d87
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 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 = +'_'

UUID_PREFIX = '_'
@@prefix = '_'.freeze

# 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 All @@ -262,11 +266,11 @@ def self.status_error_msg(error_msg, raw_status_code = nil, status_message = nil
else
printable_code = raw_status_code.split(':').last
end
error_msg += ', was ' + printable_code
error_msg << ', was ' + printable_code
end

unless status_message.nil?
error_msg += ' -> ' + status_message
error_msg << ' -> ' + status_message
end

error_msg
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

0 comments on commit 6c51d87

Please sign in to comment.