@@ -32,7 +32,9 @@ def self.format_cert(cert)
32
32
formatted_cert . join ( "\n " )
33
33
else
34
34
cert = cert . gsub ( /\- {5}\s ?(BEGIN|END) CERTIFICATE\s ?\- {5}/ , "" )
35
- cert = cert . gsub ( /[\n \r \s ]/ , "" )
35
+ cert = cert . gsub ( /\r / , "" )
36
+ cert = cert . gsub ( /\n / , "" )
37
+ cert = cert . gsub ( /\s / , "" )
36
38
cert = cert . scan ( /.{1,64}/ )
37
39
cert = cert . join ( "\n " )
38
40
"-----BEGIN CERTIFICATE-----\n #{ cert } \n -----END CERTIFICATE-----"
@@ -51,7 +53,9 @@ def self.format_private_key(key)
51
53
# is this an rsa key?
52
54
rsa_key = key . match ( "RSA PRIVATE KEY" )
53
55
key = key . gsub ( /\- {5}\s ?(BEGIN|END)( RSA)? PRIVATE KEY\s ?\- {5}/ , "" )
54
- key = key . gsub ( /[\n \r \s ]/ , "" )
56
+ key = key . gsub ( /\n / , "" )
57
+ key = key . gsub ( /\r / , "" )
58
+ key = key . gsub ( /\s / , "" )
55
59
key = key . scan ( /.{1,64}/ )
56
60
key = key . join ( "\n " )
57
61
key_label = rsa_key ? "RSA PRIVATE KEY" : "PRIVATE KEY"
@@ -98,7 +102,7 @@ def self.build_query_from_raw_parts(params)
98
102
# @param rawparams [Hash] Raw GET Parameters
99
103
# @param params [Hash] GET Parameters
100
104
# @return [Hash] New raw parameters
101
- #
105
+ #
102
106
def self . prepare_raw_get_params ( rawparams , params )
103
107
rawparams ||= { }
104
108
@@ -107,7 +111,7 @@ def self.prepare_raw_get_params(rawparams, params)
107
111
end
108
112
if rawparams [ 'SAMLResponse' ] . nil? && !params [ 'SAMLResponse' ] . nil?
109
113
rawparams [ 'SAMLResponse' ] = CGI . escape ( params [ 'SAMLResponse' ] )
110
- end
114
+ end
111
115
if rawparams [ 'RelayState' ] . nil? && !params [ 'RelayState' ] . nil?
112
116
rawparams [ 'RelayState' ] = CGI . escape ( params [ 'RelayState' ] )
113
117
end
@@ -136,16 +140,16 @@ def self.verify_signature(params)
136
140
# @param status_code [String] StatusCode value
137
141
# @param status_message [Strig] StatusMessage value
138
142
# @return [String] The status error message
139
- def self . status_error_msg ( error_msg , status_code = nil , status_message = nil )
140
- unless status_code . nil?
141
- if status_code . include? "|"
142
- status_codes = status_code . split ( ' | ' )
143
+ def self . status_error_msg ( error_msg , raw_status_code = nil , status_message = nil )
144
+ unless raw_status_code . nil?
145
+ if raw_status_code . include? "|"
146
+ status_codes = raw_status_code . split ( ' | ' )
143
147
values = status_codes . collect do |status_code |
144
148
status_code . split ( ':' ) . last
145
149
end
146
150
printable_code = values . join ( " => " )
147
151
else
148
- printable_code = status_code . split ( ':' ) . last
152
+ printable_code = raw_status_code . split ( ':' ) . last
149
153
end
150
154
error_msg << ', was ' + printable_code
151
155
end
0 commit comments