omniauth-aleph 0.1.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +3 -5
- data/Gemfile +4 -11
- data/README.md +6 -6
- data/lib/omniauth/aleph/version.rb +1 -1
- data/omniauth-aleph.gemspec +11 -11
- data/spec/omniauth/strategies/aleph_spec.rb +31 -29
- data/spec/spec_helper.rb +0 -3
- metadata +60 -58
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: aab1e7e2aa996e8844f614953a5f835de9d082a4
|
4
|
+
data.tar.gz: 0d01f4578451e8be105da928ab5e32df896312dd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bfb2f4f6d321b772dd89d6e006bf44dcf0fa0cec722208e62c5da92a8a4fd3f4cec11967f77baa03ad3f0dc0acfc0abe8db90b9b91e871a33078182fb726b939
|
7
|
+
data.tar.gz: 0a7af65f9020d13750d93297a8ea1515193f46c0b358a98a646b63d0f4fceabae4f9d3cfc6200b9a7e3b2347a1801174a8af2859cba3e8ec33dc6225270d4ac6
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -1,16 +1,9 @@
|
|
1
1
|
source 'http://rubygems.org'
|
2
2
|
gemspec
|
3
3
|
|
4
|
-
gem
|
5
|
-
gem
|
6
|
-
gem "pry", group: :development, platforms: [:jruby, :rbx]
|
7
|
-
|
8
|
-
platforms :rbx do
|
9
|
-
gem 'rubysl', '~> 2.0' # if using anything in the ruby standard library
|
10
|
-
gem 'json', '~> 1.8.1'
|
11
|
-
gem 'rubinius-coverage'
|
12
|
-
end
|
4
|
+
gem 'coveralls', '~> 0.8.0', require: false, group: :test
|
5
|
+
gem 'pry', group: :development
|
13
6
|
|
14
7
|
# XML parsing
|
15
|
-
gem 'ox', '~> 2.1
|
16
|
-
gem 'nokogiri', '~> 1.
|
8
|
+
gem 'ox', '~> 2.1', platform: :ruby
|
9
|
+
gem 'nokogiri', '~> 1.8', platform: :jruby
|
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# OmniAuth Aleph
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/omniauth-aleph.png)](http://badge.fury.io/rb/omniauth-aleph)
|
3
|
-
[![Build Status](https://api.travis-ci.org/
|
4
|
-
[![Dependency Status](https://gemnasium.com/
|
5
|
-
[![Code Climate](https://codeclimate.com/github/
|
6
|
-
[![Coverage Status](https://coveralls.io/repos/
|
3
|
+
[![Build Status](https://api.travis-ci.org/NYULibraries/omniauth-aleph.png?branch=master)](https://travis-ci.org/NYULibraries/omniauth-aleph)
|
4
|
+
[![Dependency Status](https://gemnasium.com/NYULibraries/omniauth-aleph.png)](https://gemnasium.com/NYULibraries/omniauth-aleph)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/NYULibraries/omniauth-aleph.png)](https://codeclimate.com/github/NYULibraries/omniauth-aleph)
|
6
|
+
[![Coverage Status](https://coveralls.io/repos/NYULibraries/omniauth-aleph/badge.png?branch=master)](https://coveralls.io/r/NYULibraries/omniauth-aleph)
|
7
7
|
|
8
8
|
Aleph patron login strategy for OmniAuth.
|
9
9
|
|
@@ -20,7 +20,7 @@ returns the attributes from the returned XML.
|
|
20
20
|
|
21
21
|
Use the Aleph strategy as a middleware in your application:
|
22
22
|
|
23
|
-
use OmniAuth::Strategies::Aleph, title: 'My Library's Aleph',
|
23
|
+
use OmniAuth::Strategies::Aleph, title: 'My Library's Aleph',
|
24
24
|
host: 'aleph.library.edu', port: 80, library: 'ADM50', sub_library: 'SUB'
|
25
25
|
|
26
26
|
## Configuring
|
@@ -170,4 +170,4 @@ Here's an example _Auth Hash_ available in `request.env['omniauth.auth']`:
|
|
170
170
|
}
|
171
171
|
}
|
172
172
|
}
|
173
|
-
}
|
173
|
+
}
|
data/omniauth-aleph.gemspec
CHANGED
@@ -4,10 +4,10 @@ require File.expand_path('../lib/omniauth/aleph/version', __FILE__)
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.name = 'omniauth-aleph'
|
6
6
|
gem.version = OmniAuth::Aleph::VERSION
|
7
|
-
gem.authors = ['Scot Dalton']
|
8
|
-
gem.email = ['scotdalton@gmail.com']
|
7
|
+
gem.authors = ['Scot Dalton','Barnaby Alter']
|
8
|
+
gem.email = ['scotdalton@gmail.com','barnaby.alter@nyu.edu']
|
9
9
|
gem.summary = 'Aleph Patron Login Strategy for OmniAuth'
|
10
|
-
gem.homepage = 'https://github.com/
|
10
|
+
gem.homepage = 'https://github.com/NYULibraries/omniauth-aleph'
|
11
11
|
gem.license = 'MIT'
|
12
12
|
|
13
13
|
gem.files = `git ls-files`.split("\n")
|
@@ -15,13 +15,13 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
16
16
|
gem.require_paths = ['lib']
|
17
17
|
|
18
|
-
gem.add_runtime_dependency 'omniauth', '~> 1.2
|
19
|
-
gem.add_runtime_dependency 'faraday', '~> 0.9
|
20
|
-
gem.add_runtime_dependency 'multi_xml', '~> 0.5
|
18
|
+
gem.add_runtime_dependency 'omniauth', '~> 1.2'
|
19
|
+
gem.add_runtime_dependency 'faraday', '~> 0.9'
|
20
|
+
gem.add_runtime_dependency 'multi_xml', '~> 0.5'
|
21
21
|
|
22
|
-
gem.add_development_dependency 'rake', '
|
23
|
-
gem.add_development_dependency 'rspec', '
|
24
|
-
gem.add_development_dependency 'rack-test', '~> 0.6
|
25
|
-
gem.add_development_dependency 'webmock', '
|
26
|
-
gem.add_development_dependency 'vcr', '
|
22
|
+
gem.add_development_dependency 'rake', '>= 10.1.0', '~> 11'
|
23
|
+
gem.add_development_dependency 'rspec', '>= 2.14.0', '< 4'
|
24
|
+
gem.add_development_dependency 'rack-test', '~> 0.6'
|
25
|
+
gem.add_development_dependency 'webmock', '>= 1.17.0', '< 4'
|
26
|
+
gem.add_development_dependency 'vcr', '>= 2.8.0', '< 4'
|
27
27
|
end
|
@@ -6,8 +6,8 @@ describe "OmniAuth::Strategies::Aleph" do
|
|
6
6
|
|
7
7
|
subject(:strategy) do
|
8
8
|
OmniAuth::Strategies::Aleph.new(nil, config).tap do |strategy|
|
9
|
-
strategy.
|
10
|
-
strategy.
|
9
|
+
allow(strategy).to receive(:username).and_return(aleph_username)
|
10
|
+
allow(strategy).to receive(:password).and_return(aleph_password)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -35,58 +35,60 @@ describe "OmniAuth::Strategies::Aleph" do
|
|
35
35
|
# First argument is the app, which gets called with env,
|
36
36
|
# i.e. app.call(env), so fake it with a stabby lambda
|
37
37
|
OmniAuth::Strategies::Aleph.new(->(env) {}, config).tap do |strategy|
|
38
|
-
strategy.
|
39
|
-
strategy.
|
40
|
-
strategy.
|
41
|
-
strategy.
|
38
|
+
allow(strategy).to receive(:username).and_return(aleph_username)
|
39
|
+
allow(strategy).to receive(:password).and_return(aleph_password)
|
40
|
+
allow(strategy).to receive(:env).and_return({})
|
41
|
+
allow(strategy).to receive(:fail!).and_return(true)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
describe '#options' do
|
46
46
|
subject(:options) { strategy.options }
|
47
47
|
|
48
|
-
it
|
48
|
+
it 'should not raise an error' do
|
49
|
+
expect { subject }.to_not raise_error
|
50
|
+
end
|
49
51
|
|
50
52
|
describe'#name' do
|
51
53
|
subject { options.name }
|
52
|
-
it {
|
53
|
-
it {
|
54
|
+
it { is_expected.to_not be_nil }
|
55
|
+
it { is_expected.to eq("aleph") }
|
54
56
|
end
|
55
57
|
|
56
58
|
describe '#title' do
|
57
59
|
subject { options.title }
|
58
|
-
it {
|
59
|
-
it {
|
60
|
+
it { is_expected.to_not be_nil }
|
61
|
+
it { is_expected.to eq("Aleph Authentication") }
|
60
62
|
end
|
61
63
|
|
62
64
|
describe '#scheme' do
|
63
65
|
subject { options.scheme }
|
64
|
-
it {
|
65
|
-
it {
|
66
|
+
it { is_expected.to_not be_nil }
|
67
|
+
it { is_expected.to eq("http") }
|
66
68
|
end
|
67
69
|
|
68
70
|
describe '#host' do
|
69
71
|
subject { options.host }
|
70
|
-
it {
|
71
|
-
it {
|
72
|
+
it { is_expected.to_not be_nil }
|
73
|
+
it { is_expected.to eq(aleph_host) }
|
72
74
|
end
|
73
75
|
|
74
76
|
describe '#port' do
|
75
77
|
subject { options.port }
|
76
|
-
it {
|
77
|
-
it {
|
78
|
+
it { is_expected.to_not be_nil }
|
79
|
+
it { is_expected.to be(80) }
|
78
80
|
end
|
79
81
|
|
80
82
|
describe '#library' do
|
81
83
|
subject { options.library }
|
82
|
-
it {
|
83
|
-
it {
|
84
|
+
it { is_expected.to_not be_nil }
|
85
|
+
it { is_expected.to eq(aleph_library) }
|
84
86
|
end
|
85
87
|
|
86
88
|
describe '#sub_library' do
|
87
89
|
subject { options.sub_library }
|
88
|
-
it {
|
89
|
-
it {
|
90
|
+
it { is_expected.to_not be_nil }
|
91
|
+
it { is_expected.to eq(aleph_sub_library) }
|
90
92
|
end
|
91
93
|
end
|
92
94
|
|
@@ -99,9 +101,9 @@ describe "OmniAuth::Strategies::Aleph" do
|
|
99
101
|
describe "#callback_phase", vcr: { cassette_name: "valid" } do
|
100
102
|
context "when the credentials are missing" do
|
101
103
|
before(:each) do |example|
|
102
|
-
strategy.
|
103
|
-
strategy.
|
104
|
-
end
|
104
|
+
allow(strategy).to receive(:username).and_return("")
|
105
|
+
allow(strategy).to receive(:password).and_return("")
|
106
|
+
end
|
105
107
|
|
106
108
|
it 'shouldn\'t raise an error' do
|
107
109
|
expect{ strategy.callback_phase }.not_to raise_error
|
@@ -115,14 +117,14 @@ describe "OmniAuth::Strategies::Aleph" do
|
|
115
117
|
|
116
118
|
context "when the credentials are included" do
|
117
119
|
before(:each) do
|
118
|
-
strategy.
|
119
|
-
strategy.
|
120
|
-
end
|
120
|
+
allow(strategy).to receive(:username).and_return(aleph_username)
|
121
|
+
allow(strategy).to receive(:password).and_return(aleph_password)
|
122
|
+
end
|
121
123
|
|
122
124
|
it 'shouldn\'t raise an error' do
|
123
125
|
expect{ strategy.callback_phase }.not_to raise_error
|
124
126
|
end
|
125
|
-
|
127
|
+
|
126
128
|
it 'shouldn\'t fail!' do
|
127
129
|
strategy.callback_phase
|
128
130
|
expect(strategy).not_to have_received(:fail!)
|
@@ -236,7 +238,7 @@ describe "OmniAuth::Strategies::Aleph" do
|
|
236
238
|
expect(auth_hash.info.name).to eq('USERNAME, TEST-RECORD')
|
237
239
|
expect(auth_hash.info.nickname).to eq('USERNAME')
|
238
240
|
expect(auth_hash.info.email).to eq('username@library.edu')
|
239
|
-
expect(auth_hash.info.phone).to
|
241
|
+
expect(auth_hash.info.phone).to be_blank
|
240
242
|
expect(auth_hash.extra.raw_info.bor_auth.z303.z303_id).to eq('USERNAME')
|
241
243
|
end
|
242
244
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -53,7 +53,4 @@ RSpec.configure do |config|
|
|
53
53
|
config.expect_with :rspec do |c|
|
54
54
|
c.syntax = :expect
|
55
55
|
end
|
56
|
-
# so we can use :vcr rather than :vcr => true;
|
57
|
-
# in RSpec 3 this will no longer be necessary.
|
58
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
59
56
|
end
|
metadata
CHANGED
@@ -1,153 +1,162 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-aleph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Scot Dalton
|
8
|
+
- Barnaby Alter
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-08-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
17
|
requirements:
|
19
|
-
- - ~>
|
18
|
+
- - "~>"
|
20
19
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.2
|
20
|
+
version: '1.2'
|
22
21
|
type: :runtime
|
23
22
|
prerelease: false
|
24
23
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
24
|
requirements:
|
27
|
-
- - ~>
|
25
|
+
- - "~>"
|
28
26
|
- !ruby/object:Gem::Version
|
29
|
-
version: 1.2
|
27
|
+
version: '1.2'
|
30
28
|
- !ruby/object:Gem::Dependency
|
31
29
|
name: faraday
|
32
30
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
31
|
requirements:
|
35
|
-
- - ~>
|
32
|
+
- - "~>"
|
36
33
|
- !ruby/object:Gem::Version
|
37
|
-
version: 0.9
|
34
|
+
version: '0.9'
|
38
35
|
type: :runtime
|
39
36
|
prerelease: false
|
40
37
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
38
|
requirements:
|
43
|
-
- - ~>
|
39
|
+
- - "~>"
|
44
40
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.9
|
41
|
+
version: '0.9'
|
46
42
|
- !ruby/object:Gem::Dependency
|
47
43
|
name: multi_xml
|
48
44
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
45
|
requirements:
|
51
|
-
- - ~>
|
46
|
+
- - "~>"
|
52
47
|
- !ruby/object:Gem::Version
|
53
|
-
version: 0.5
|
48
|
+
version: '0.5'
|
54
49
|
type: :runtime
|
55
50
|
prerelease: false
|
56
51
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
52
|
requirements:
|
59
|
-
- - ~>
|
53
|
+
- - "~>"
|
60
54
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.5
|
55
|
+
version: '0.5'
|
62
56
|
- !ruby/object:Gem::Dependency
|
63
57
|
name: rake
|
64
58
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
59
|
requirements:
|
67
|
-
- -
|
60
|
+
- - ">="
|
68
61
|
- !ruby/object:Gem::Version
|
69
62
|
version: 10.1.0
|
63
|
+
- - "~>"
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '11'
|
70
66
|
type: :development
|
71
67
|
prerelease: false
|
72
68
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
69
|
requirements:
|
75
|
-
- -
|
70
|
+
- - ">="
|
76
71
|
- !ruby/object:Gem::Version
|
77
72
|
version: 10.1.0
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '11'
|
78
76
|
- !ruby/object:Gem::Dependency
|
79
77
|
name: rspec
|
80
78
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
79
|
requirements:
|
83
|
-
- -
|
80
|
+
- - ">="
|
84
81
|
- !ruby/object:Gem::Version
|
85
82
|
version: 2.14.0
|
83
|
+
- - "<"
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '4'
|
86
86
|
type: :development
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
89
|
requirements:
|
91
|
-
- -
|
90
|
+
- - ">="
|
92
91
|
- !ruby/object:Gem::Version
|
93
92
|
version: 2.14.0
|
93
|
+
- - "<"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '4'
|
94
96
|
- !ruby/object:Gem::Dependency
|
95
97
|
name: rack-test
|
96
98
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
99
|
requirements:
|
99
|
-
- - ~>
|
100
|
+
- - "~>"
|
100
101
|
- !ruby/object:Gem::Version
|
101
|
-
version: 0.6
|
102
|
+
version: '0.6'
|
102
103
|
type: :development
|
103
104
|
prerelease: false
|
104
105
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
106
|
requirements:
|
107
|
-
- - ~>
|
107
|
+
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 0.6
|
109
|
+
version: '0.6'
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
111
|
name: webmock
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
113
|
requirements:
|
115
|
-
- -
|
114
|
+
- - ">="
|
116
115
|
- !ruby/object:Gem::Version
|
117
116
|
version: 1.17.0
|
117
|
+
- - "<"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '4'
|
118
120
|
type: :development
|
119
121
|
prerelease: false
|
120
122
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
123
|
requirements:
|
123
|
-
- -
|
124
|
+
- - ">="
|
124
125
|
- !ruby/object:Gem::Version
|
125
126
|
version: 1.17.0
|
127
|
+
- - "<"
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '4'
|
126
130
|
- !ruby/object:Gem::Dependency
|
127
131
|
name: vcr
|
128
132
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
133
|
requirements:
|
131
|
-
- -
|
134
|
+
- - ">="
|
132
135
|
- !ruby/object:Gem::Version
|
133
136
|
version: 2.8.0
|
137
|
+
- - "<"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '4'
|
134
140
|
type: :development
|
135
141
|
prerelease: false
|
136
142
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
143
|
requirements:
|
139
|
-
- -
|
144
|
+
- - ">="
|
140
145
|
- !ruby/object:Gem::Version
|
141
146
|
version: 2.8.0
|
147
|
+
- - "<"
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '4'
|
142
150
|
description:
|
143
151
|
email:
|
144
152
|
- scotdalton@gmail.com
|
153
|
+
- barnaby.alter@nyu.edu
|
145
154
|
executables: []
|
146
155
|
extensions: []
|
147
156
|
extra_rdoc_files: []
|
148
157
|
files:
|
149
|
-
- .gitignore
|
150
|
-
- .travis.yml
|
158
|
+
- ".gitignore"
|
159
|
+
- ".travis.yml"
|
151
160
|
- Gemfile
|
152
161
|
- LICENSE
|
153
162
|
- README.md
|
@@ -170,36 +179,29 @@ files:
|
|
170
179
|
- spec/vcr_cassettes/nil_password.yml
|
171
180
|
- spec/vcr_cassettes/nonexistent_user.yml
|
172
181
|
- spec/vcr_cassettes/valid.yml
|
173
|
-
homepage: https://github.com/
|
182
|
+
homepage: https://github.com/NYULibraries/omniauth-aleph
|
174
183
|
licenses:
|
175
184
|
- MIT
|
185
|
+
metadata: {}
|
176
186
|
post_install_message:
|
177
187
|
rdoc_options: []
|
178
188
|
require_paths:
|
179
189
|
- lib
|
180
190
|
required_ruby_version: !ruby/object:Gem::Requirement
|
181
|
-
none: false
|
182
191
|
requirements:
|
183
|
-
- -
|
192
|
+
- - ">="
|
184
193
|
- !ruby/object:Gem::Version
|
185
194
|
version: '0'
|
186
|
-
segments:
|
187
|
-
- 0
|
188
|
-
hash: 563932762752653555
|
189
195
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
190
|
-
none: false
|
191
196
|
requirements:
|
192
|
-
- -
|
197
|
+
- - ">="
|
193
198
|
- !ruby/object:Gem::Version
|
194
199
|
version: '0'
|
195
|
-
segments:
|
196
|
-
- 0
|
197
|
-
hash: 563932762752653555
|
198
200
|
requirements: []
|
199
201
|
rubyforge_project:
|
200
|
-
rubygems_version:
|
202
|
+
rubygems_version: 2.5.2
|
201
203
|
signing_key:
|
202
|
-
specification_version:
|
204
|
+
specification_version: 4
|
203
205
|
summary: Aleph Patron Login Strategy for OmniAuth
|
204
206
|
test_files:
|
205
207
|
- spec/omniauth/aleph/adaptor_spec.rb
|