dlindahl/omniauth-cas — Issue #3: Service Ticket Validation Failure
Author: iterateNZ
Created: 2012-01-15 21:31:45+00:00
State: open

Service ticket is failing validation as the service_url is changing from unescaped to escaped.

https://github.com/dlindahl/omniauth-cas/blob/master/lib/omniauth/strategies/cas.rb
Line 108 { :service => service_url.to_s, :ticket => ticket }
Line 117 { :service => Rack::Utils.unescape(service) }

## Rails Log:
Started GET "/users/auth/cas" for 127.0.0.1 at Mon Jan 16 10:12:25 +1300 2012

Started GET "/users/auth/cas/callback?url=http://127.0.0.10/&ticket=ST-1-LI2RfXBXynZ3wbFcv9Vl-sso.myacg.org" for 127.0.0.1 at Mon Jan 16 10:12:25 +1300 2012
Dalli::Server#connect 127.0.0.1:11211
Processing by Users::OmniauthCallbacksController#failure as HTML
Parameters: {"ticket"=>"ST-1-LI2RfXBXynZ3wbFcv9Vl-sso.myacg.org", "url"=>"http://127.0.0.10/"}
Redirected to http://127.0.0.10/users/sign_in
Completed 302 Found in 1ms

## Cas Log:
2012-01-16 10:12:25,445 INFO [org.jasig.cas.CentralAuthenticationServiceImpl] - Granted service ticket [ST-1-LI2RfXBXynZ3wbFcv9Vl-sso.myacg.org] for service [http://127.0.0.10/users/auth/cas/callback?url=http://127.0.0.10/] for user [052463]
2012-01-16 10:12:26,127 ERROR [org.jasig.cas.CentralAuthenticationServiceImpl] - ServiceTicket [ST-1-LI2RfXBXynZ3wbFcv9Vl-sso.myacg.org] with service [http://127.0.0.10/users/auth/cas/callback?url=http://127.0.0.10/ does not match supplied service [http://127.0.0.10/users/auth/cas/callback?url=http%3A%2F%2F127.0.0.10%2F]

It does work if there is no url param

## Rails.log
Started GET "/users/auth/cas" for 127.0.0.1 at Mon Jan 16 10:27:14 +1300 2012

Started GET "/users/auth/cas/callback?url=&ticket=ST-4-osxtwCW30aIfMf5auBej-sso.myacg.org" for 127.0.0.1 at Mon Jan 16 10:27:15 +1300 2012
Processing by Users::OmniauthCallbacksController#cas as HTML
Parameters: {"ticket"=>"ST-4-osxtwCW30aIfMf5auBej-sso.myacg.org", "url"=>""}

## Cas.log
2012-01-16 10:27:15,068 INFO [org.jasig.cas.CentralAuthenticationServiceImpl] - Granted service ticket [ST-4-osxtwCW30aIfMf5auBej-sso.myacg.org] for service [http://127.0.0.10/users/auth/cas/callback?url=] for user [052463]

## Gems:
devise 1.5.3
omniauth 1.0.1
omniauth-cas 0.0.3