casino 2.0.4 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data.tar.gz.sig CHANGED
@@ -1 +1,2 @@
1
- %�hwZ���;֫bu�W��}��{��#���b<�~H��`i��� q2��I_k��CUޣ��
1
+ T+����~W����f`oYJVO��j��Z��t�Qv% L䕜&���������e���3 �~Ao���gA�$z%6��r��8�N�QN|~[�0��jeN:׷��[]Oq�v��řyo�
2
+ ��� �?�V�|�d1�w�A���t�<��������d��7��ϝ�Tk�(-�d����3s�'�-�]7��遴�$�^I�u�=�W�d/�w�ע��ހq��������Q�X�9���y��zHM�n�γ^dY��
@@ -19,6 +19,13 @@ class CASino::ServiceTicket < ActiveRecord::Base
19
19
  self.delete_all(['created_at < ? AND consumed = ?', (CASino.config.service_ticket[:lifetime_consumed].seconds * 2).ago, true])
20
20
  end
21
21
 
22
+
23
+ def service=(service)
24
+ normalized_encoded_service = Addressable::URI.parse(service).normalize.to_str
25
+ super(normalized_encoded_service)
26
+ end
27
+
28
+
22
29
  def service_with_ticket_url
23
30
  service_uri = Addressable::URI.parse(self.service)
24
31
  service_uri.query_values = (service_uri.query_values(Array) || []) << ['ticket', self.ticket]
@@ -1,3 +1,3 @@
1
1
  module CASino
2
- VERSION = '2.0.4'
2
+ VERSION = '2.0.5'
3
3
  end
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe CASino::ServiceTicket do
@@ -116,9 +118,33 @@ describe CASino::ServiceTicket do
116
118
  end
117
119
 
118
120
  describe '#service_with_ticket_url' do
119
- it 'does not escape the url from the database' do
120
- unconsumed_ticket.service = 'https://host.example.org/test.php?t=other&other=testing'
121
- unconsumed_ticket.service_with_ticket_url.should eq('https://host.example.org/test.php?t=other&other=testing&ticket=ST-12345')
121
+ it 'appends the service ticket id to the querystring' do
122
+ unconsumed_ticket.service = 'https://host.example.org/test.php?iam=testing'
123
+ unconsumed_ticket.service_with_ticket_url.should eq('https://host.example.org/test.php?iam=testing&ticket=ST-12345')
124
+ end
125
+ end
126
+
127
+ describe '#service=' do
128
+ it 'encodes the url before writing to the database' do
129
+ unconsumed_ticket.service = 'https://example.org/this is a test/jö.png'
130
+ unconsumed_ticket.service.should eq('https://example.org/this%20is%20a%20test/j%C3%B6.png')
131
+ end
132
+
133
+ it 'does not encode the querystring symbols (&?=) before writing to the database' do
134
+ unconsumed_ticket.service = 'https://example.org/test.php?t=other&other=testing'
135
+ unconsumed_ticket.service.should eq('https://example.org/test.php?t=other&other=testing')
136
+ end
137
+
138
+ it 'does not encode the encoded string' do
139
+ unconsumed_ticket.service = 'https://example.org/this is a test/jö.png'
140
+ unconsumed_ticket.service = unconsumed_ticket.service
141
+ unconsumed_ticket.service.should eq('https://example.org/this%20is%20a%20test/j%C3%B6.png')
142
+ end
143
+
144
+ it 'does correctly reencode slashes' do
145
+ unconsumed_ticket.service = 'https://example.com/login?os_destination=http%3A%2F%2Fexample.com%2Fdisplay%2FTesting%2F%3Fa%3D1%26b%3D2'
146
+ unconsumed_ticket.service = unconsumed_ticket.service
147
+ unconsumed_ticket.service.should eq('https://example.com/login?os_destination=http://example.com/display/Testing/?a=1%26b=2')
122
148
  end
123
149
  end
124
150
  end
@@ -46,4 +46,4 @@ describe CASino::ProcessorConcern::ServiceTickets do
46
46
  end
47
47
  end
48
48
  end
49
- end
49
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: casino
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -38,7 +38,7 @@ cert_chain:
38
38
  b1VSdnUwRzgvWXlIVUFtSVUvV0tyanIxYmdjZjFWUnYKUjRLRDFNblVWL3Y1
39
39
  MDJwaU1sWG1qeE9XZGJLOHl2UUVIa3N1L3pqYkNqU3UrTTJrd0ZtV0dzeDVu
40
40
  eCtWZHc9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
41
- date: 2014-02-05 00:00:00.000000000 Z
41
+ date: 2014-03-20 00:00:00.000000000 Z
42
42
  dependencies:
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: capybara
metadata.gz.sig CHANGED
Binary file