omniauth-cas 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,8 @@
1
- rvm: 1.9.2
1
+ rvm:
2
+ - 1.9.2
3
+ - 1.9.3
2
4
  branches:
3
5
  only:
4
6
  - master
5
-
7
+ before_install:
8
+ - gem install bundler
data/Gemfile CHANGED
@@ -1,5 +1,4 @@
1
1
  source 'https://rubygems.org'
2
- ruby '1.9.3'
3
2
 
4
3
  # Specify your gem's dependencies in omniauth-cas.gemspec
5
4
  gemspec
data/README.md CHANGED
@@ -36,19 +36,20 @@ end
36
36
 
37
37
  OmniAuth CAS requires at least one of the following two configuration options:
38
38
 
39
- * `host` - Defines the host of your CAS server. A default login URL of `/login` will be assumed.
40
- * `login_url` - Defines the URL used to prompt users for their login information.
39
+ * `url` - Defines the URL of your CAS server (i.e. `http://example.org:8080`)
40
+ * `host` - Defines the host of your CAS server. Optional if using `url`
41
+ * `login_url` - Defines the URL used to prompt users for their login information. Defaults to `/login`
41
42
  If no `host` is configured, the host application's domain will be used.
42
43
 
43
44
  Other configuration options:
44
45
 
45
- * `port` - The port to use for your configured CAS `host`
46
- * `ssl` - TRUE to connect to your CAS server over SSL.
46
+ * `port` - The port to use for your configured CAS `host`. Optional if using `url`
47
+ * `ssl` - TRUE to connect to your CAS server over SSL. Optional if using `url`
47
48
  * `service_validate_url` - The URL to use to validate a user. Defaults to `'/serviceValidate'`
48
49
  * `logout_url` - The URL to use to logout a user. Defaults to `'/logout'`
49
50
  * `uid_key` - The user data attribute to use as your user's unique identifier. Defaults to `'user'` (which usually contains the user's login name)
50
51
  * `ca_path` - Optional when `ssl` is `true`. Sets path of a CA certification directory. See [Net::HTTP][net_http] for more details
51
- * `disable_ssl_verification``- Optional when `ssl` is true. Disables verification.
52
+ * `disable_ssl_verification` - Optional when `ssl` is true. Disables verification.
52
53
 
53
54
  ## Migrating from OmniAuth 0.3
54
55
 
data/Rakefile CHANGED
@@ -1,12 +1,14 @@
1
1
  #!/usr/bin/env rake
2
- require "bundler/gem_tasks"
2
+ require 'bundler/gem_tasks'
3
3
 
4
4
  require 'rspec/core/rake_task'
5
5
  desc 'Default: run specs.'
6
- task :default => :spec
6
+ task default: :spec
7
7
 
8
- desc "Run specs"
9
- RSpec::Core::RakeTask.new
8
+ desc 'Run specs'
9
+ RSpec::Core::RakeTask.new(:spec) do |t|
10
+ t.rspec_opts = '--require spec_helper --color --order rand'
11
+ end
10
12
 
11
13
  task :test do
12
14
  fail %q{This application uses RSpec. Try running "rake spec"}
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Cas
3
- VERSION = '1.0.0'
3
+ VERSION = '1.0.1'
4
4
  end
5
5
  end
@@ -6,11 +6,23 @@ module OmniAuth
6
6
  def initialize( options )
7
7
  @options = options
8
8
 
9
+ extract_url if @options['url']
10
+
9
11
  validate_cas_setup
10
12
  end
11
13
 
14
+ def extract_url
15
+ url = Addressable::URI.parse( @options.delete('url') )
16
+
17
+ @options.merge!(
18
+ 'host' => url.host,
19
+ 'port' => url.port,
20
+ 'ssl' => url.scheme == 'https'
21
+ )
22
+ end
23
+
12
24
  def validate_cas_setup
13
- if @options.host.nil? or @options.login_url.nil?
25
+ if @options.host.nil? || @options.login_url.nil?
14
26
  raise ArgumentError.new(":host and :login_url MUST be provided")
15
27
  end
16
28
  end
@@ -0,0 +1,57 @@
1
+ describe OmniAuth::Strategies::CAS::Configuration do
2
+ subject { described_class.new }
3
+
4
+ let(:options) { Hashie::Mash.new params }
5
+
6
+ let(:params) do
7
+ {
8
+ 'host' => 'example.org',
9
+ 'login_url' => '/'
10
+ }
11
+ end
12
+
13
+ describe '#initialize' do
14
+ let(:params) do
15
+ {
16
+ 'url' => 'http://example.org:8080',
17
+ 'login_url' => '/'
18
+ }
19
+ end
20
+
21
+ it 'should initialize the configuration' do
22
+ described_class.any_instance.should_receive(:extract_url)
23
+ described_class.any_instance.should_receive(:validate_cas_setup)
24
+
25
+ described_class.new options
26
+ end
27
+
28
+ context 'with a URL property' do
29
+ subject { described_class.new( options ).instance_variable_get('@options') }
30
+
31
+ it 'should parse the URL' do
32
+ subject.host.should eq 'example.org'
33
+ subject.port.should eq 8080
34
+ subject.ssl.should be_false
35
+ end
36
+ end
37
+
38
+ context 'without a URL property' do
39
+ let(:params) do
40
+ {
41
+ 'host' => 'example.org',
42
+ 'login_url' => '/'
43
+ }
44
+ end
45
+
46
+ subject { described_class.new( options ) }
47
+
48
+ it 'should not parse the url' do
49
+ described_class.any_instance
50
+ .should_receive(:extract_url)
51
+ .never
52
+
53
+ described_class.new options
54
+ end
55
+ end
56
+ end
57
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-cas
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-04 00:00:00.000000000 Z
12
+ date: 2012-12-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omniauth
@@ -179,6 +179,7 @@ files:
179
179
  - omniauth-cas.gemspec
180
180
  - spec/fixtures/cas_failure.xml
181
181
  - spec/fixtures/cas_success.xml
182
+ - spec/omniauth/strategies/cas/configuration_spec.rb
182
183
  - spec/omniauth/strategies/cas/service_ticket_validator_spec.rb
183
184
  - spec/omniauth/strategies/cas_spec.rb
184
185
  - spec/spec_helper.rb
@@ -194,12 +195,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
194
195
  - - ! '>='
195
196
  - !ruby/object:Gem::Version
196
197
  version: '0'
198
+ segments:
199
+ - 0
200
+ hash: 3594521613564365784
197
201
  required_rubygems_version: !ruby/object:Gem::Requirement
198
202
  none: false
199
203
  requirements:
200
204
  - - ! '>='
201
205
  - !ruby/object:Gem::Version
202
206
  version: '0'
207
+ segments:
208
+ - 0
209
+ hash: 3594521613564365784
203
210
  requirements: []
204
211
  rubyforge_project:
205
212
  rubygems_version: 1.8.24
@@ -209,6 +216,7 @@ summary: CAS Strategy for OmniAuth
209
216
  test_files:
210
217
  - spec/fixtures/cas_failure.xml
211
218
  - spec/fixtures/cas_success.xml
219
+ - spec/omniauth/strategies/cas/configuration_spec.rb
212
220
  - spec/omniauth/strategies/cas/service_ticket_validator_spec.rb
213
221
  - spec/omniauth/strategies/cas_spec.rb
214
222
  - spec/spec_helper.rb