File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -190,8 +190,15 @@ def parse_http_response(http_response)
190
190
if location =~ /ticket=([^&]+)/
191
191
@ticket = $~[ 1 ]
192
192
end
193
-
194
- unless http_response . kind_of? ( Net ::HTTPSeeOther ) && @ticket . present?
193
+
194
+ # Legacy check. CAS Server used to return a 200 (Success) or a 302 (Found) on successful authentication.
195
+ # This behavior should be deprecated at some point in the future.
196
+ legacy_valid_ticket = ( http_response . kind_of? ( Net ::HTTPSuccess ) || http_response . kind_of? ( Net ::HTTPFound ) ) && @ticket . present?
197
+
198
+ # If using rubycas-server 1.1.0+
199
+ valid_ticket = http_response . kind_of? ( Net ::HTTPSeeOther ) && @ticket . present?
200
+
201
+ if !legacy_valid_ticket && !valid_ticket
195
202
@failure = true
196
203
# Try to extract the error message -- this only works with RubyCAS-Server.
197
204
# For other servers we just return the entire response body (i.e. the whole error page).
You can’t perform that action at this time.
0 commit comments