cassette 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/README.md +106 -0
- data/lib/cassette/authentication/authorities.rb +37 -0
- data/lib/cassette/authentication/cache.rb +30 -0
- data/lib/cassette/authentication/filter.rb +41 -0
- data/lib/cassette/authentication/user.rb +27 -0
- data/lib/cassette/authentication.rb +72 -0
- data/lib/cassette/cache.rb +42 -0
- data/lib/cassette/client/cache.rb +43 -0
- data/lib/cassette/client.rb +68 -0
- data/lib/cassette/errors/not_a_customer.rb +14 -0
- data/lib/cassette/errors/not_an_employee.rb +14 -0
- data/lib/cassette/errors.rb +44 -0
- data/lib/cassette/rubycas/helper.rb +78 -0
- data/lib/cassette/rubycas/not_single_sign_out_constraint.rb +14 -0
- data/lib/cassette/rubycas/single_sign_out_constraint.rb +27 -0
- data/lib/cassette/rubycas.rb +11 -0
- data/lib/cassette/version.rb +15 -0
- data/lib/cassette.rb +75 -0
- data/spec/cas/authentication/authorities_spec.rb +82 -0
- data/spec/cas/authentication/cache_spec.rb +8 -0
- data/spec/cas/authentication/filter_spec.rb +172 -0
- data/spec/cas/authentication/user_spec.rb +70 -0
- data/spec/cas/authentication_spec.rb +84 -0
- data/spec/cas/cache_spec.rb +40 -0
- data/spec/cas/client/cache_spec.rb +7 -0
- data/spec/cas/errors_spec.rb +29 -0
- data/spec/cas_spec.rb +78 -0
- data/spec/config.yml +5 -0
- data/spec/fixtures/cas/fail.xml +6 -0
- data/spec/fixtures/cas/success.xml +12 -0
- data/spec/integration/cas/client_spec.rb +50 -0
- data/spec/spec_helper.rb +27 -0
- metadata +257 -0
@@ -0,0 +1,12 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'>
|
3
|
+
<cas:authenticationSuccess>
|
4
|
+
<cas:user>test-user</cas:user>
|
5
|
+
<!-- Begin Ldap Attributes -->
|
6
|
+
<cas:attributes>
|
7
|
+
<cas:authorities>[CUPOM, AUDITING,]</cas:authorities>
|
8
|
+
<cas:cn>Test System</cas:cn>
|
9
|
+
</cas:attributes>
|
10
|
+
<!-- End Ldap Attributes -->
|
11
|
+
</cas:authenticationSuccess>
|
12
|
+
</cas:serviceResponse>
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require "spec_helper"
|
4
|
+
|
5
|
+
RSpec.describe "Cassette::Client, Cassette::Authentication integration" do
|
6
|
+
shared_examples_for "a Cassette client and validator" do
|
7
|
+
let(:config) { raise "implement config!" }
|
8
|
+
let(:client) { Cassette::Client.new(config: config) }
|
9
|
+
let(:authentication) { Cassette::Authentication.new(config: config) }
|
10
|
+
|
11
|
+
it "generates an ST" do
|
12
|
+
expect(client.st_for(config.service)).not_to be_blank
|
13
|
+
end
|
14
|
+
|
15
|
+
it "validates an ST, extracting the user" do
|
16
|
+
st = client.st_for(config.service)
|
17
|
+
|
18
|
+
expect(user = authentication.ticket_user(st, config.service)).not_to be_blank
|
19
|
+
expect(user.login).to eql(config.username)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context "with a systems configuration" do
|
24
|
+
it_behaves_like "a Cassette client and validator" do
|
25
|
+
let(:config) do
|
26
|
+
OpenStruct.new(
|
27
|
+
username: "suwb",
|
28
|
+
password: "bandeirantes",
|
29
|
+
service: "support-workbench.devintegration.locaweb.com.br",
|
30
|
+
base: "https://systems-login.devintegration.locaweb.com.br",
|
31
|
+
base_authority: "SUWB"
|
32
|
+
)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context "with a human configuration" do
|
38
|
+
it_behaves_like "a Cassette client and validator" do
|
39
|
+
let(:config) do
|
40
|
+
OpenStruct.new(
|
41
|
+
service: "support-workbench.devintegration.locaweb.com.br",
|
42
|
+
base_authority: "SUWB",
|
43
|
+
username: "analista.teste",
|
44
|
+
password: "inicial1234",
|
45
|
+
base: "https://login.devintegration.locaweb.com.br"
|
46
|
+
)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
require 'simplecov-rcov'
|
3
|
+
require 'simplecov-gem-adapter'
|
4
|
+
require "yaml"
|
5
|
+
|
6
|
+
module Fixtures
|
7
|
+
def fixture(name)
|
8
|
+
File.read("spec/fixtures/#{name}")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
RSpec.configure do |config|
|
13
|
+
config.mock_framework = :rspec
|
14
|
+
config.include Fixtures
|
15
|
+
end
|
16
|
+
|
17
|
+
SimpleCov.start 'gem' do
|
18
|
+
formatter SimpleCov::Formatter::RcovFormatter
|
19
|
+
add_filter "spec/"
|
20
|
+
add_filter "vendor/"
|
21
|
+
end
|
22
|
+
|
23
|
+
require "cassette"
|
24
|
+
require "cassette/rubycas"
|
25
|
+
require "ostruct"
|
26
|
+
|
27
|
+
Cassette.config = OpenStruct.new(YAML.load_file("spec/config.yml"))
|
metadata
ADDED
@@ -0,0 +1,257 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cassette
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ricardo Hermida Ruiz
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>'
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.9'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>'
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: libxml-ruby
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: activesupport
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>'
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.1.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>'
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.1.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: httpclient
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubycas-client
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ! '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: simplecov
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ! '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: simplecov-rcov
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ! '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ! '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: simplecov-gem-adapter
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ! '>='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ! '>='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: geminabox
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ! '>='
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ! '>='
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rspec_junit_formatter
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ! '>='
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
181
|
+
description: Client for generating and validating CAS TGT/STs
|
182
|
+
email:
|
183
|
+
- ricardo.ruiz@locaweb.com.br
|
184
|
+
executables: []
|
185
|
+
extensions: []
|
186
|
+
extra_rdoc_files: []
|
187
|
+
files:
|
188
|
+
- README.md
|
189
|
+
- lib/cassette.rb
|
190
|
+
- lib/cassette/authentication.rb
|
191
|
+
- lib/cassette/authentication/authorities.rb
|
192
|
+
- lib/cassette/authentication/cache.rb
|
193
|
+
- lib/cassette/authentication/filter.rb
|
194
|
+
- lib/cassette/authentication/user.rb
|
195
|
+
- lib/cassette/cache.rb
|
196
|
+
- lib/cassette/client.rb
|
197
|
+
- lib/cassette/client/cache.rb
|
198
|
+
- lib/cassette/errors.rb
|
199
|
+
- lib/cassette/errors/not_a_customer.rb
|
200
|
+
- lib/cassette/errors/not_an_employee.rb
|
201
|
+
- lib/cassette/rubycas.rb
|
202
|
+
- lib/cassette/rubycas/helper.rb
|
203
|
+
- lib/cassette/rubycas/not_single_sign_out_constraint.rb
|
204
|
+
- lib/cassette/rubycas/single_sign_out_constraint.rb
|
205
|
+
- lib/cassette/version.rb
|
206
|
+
- spec/cas/authentication/authorities_spec.rb
|
207
|
+
- spec/cas/authentication/cache_spec.rb
|
208
|
+
- spec/cas/authentication/filter_spec.rb
|
209
|
+
- spec/cas/authentication/user_spec.rb
|
210
|
+
- spec/cas/authentication_spec.rb
|
211
|
+
- spec/cas/cache_spec.rb
|
212
|
+
- spec/cas/client/cache_spec.rb
|
213
|
+
- spec/cas/errors_spec.rb
|
214
|
+
- spec/cas_spec.rb
|
215
|
+
- spec/config.yml
|
216
|
+
- spec/fixtures/cas/fail.xml
|
217
|
+
- spec/fixtures/cas/success.xml
|
218
|
+
- spec/integration/cas/client_spec.rb
|
219
|
+
- spec/spec_helper.rb
|
220
|
+
homepage: http://github.com/locaweb/
|
221
|
+
licenses: []
|
222
|
+
metadata: {}
|
223
|
+
post_install_message:
|
224
|
+
rdoc_options: []
|
225
|
+
require_paths:
|
226
|
+
- lib
|
227
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
228
|
+
requirements:
|
229
|
+
- - ! '>='
|
230
|
+
- !ruby/object:Gem::Version
|
231
|
+
version: '0'
|
232
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
234
|
+
- - ! '>='
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: '0'
|
237
|
+
requirements: []
|
238
|
+
rubyforge_project:
|
239
|
+
rubygems_version: 2.4.1
|
240
|
+
signing_key:
|
241
|
+
specification_version: 4
|
242
|
+
summary: Generates, validates and caches TGTs and STs
|
243
|
+
test_files:
|
244
|
+
- spec/cas/authentication/authorities_spec.rb
|
245
|
+
- spec/cas/authentication/cache_spec.rb
|
246
|
+
- spec/cas/authentication/filter_spec.rb
|
247
|
+
- spec/cas/authentication/user_spec.rb
|
248
|
+
- spec/cas/authentication_spec.rb
|
249
|
+
- spec/cas/cache_spec.rb
|
250
|
+
- spec/cas/client/cache_spec.rb
|
251
|
+
- spec/cas/errors_spec.rb
|
252
|
+
- spec/cas_spec.rb
|
253
|
+
- spec/config.yml
|
254
|
+
- spec/fixtures/cas/fail.xml
|
255
|
+
- spec/fixtures/cas/success.xml
|
256
|
+
- spec/integration/cas/client_spec.rb
|
257
|
+
- spec/spec_helper.rb
|