omniauth-polaris 1.0.0
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.
- checksums.yaml +7 -0
- data/.gitignore +63 -0
- data/Gemfile +38 -0
- data/README.rdoc +3 -0
- data/Rakefile +7 -0
- data/lib/omniauth-polaris.rb +3 -0
- data/lib/omniauth-polaris/adaptor.rb +100 -0
- data/lib/omniauth-polaris/version.rb +5 -0
- data/lib/omniauth/strategies/polaris.rb +114 -0
- data/omniauth-polaris.gemspec +25 -0
- data/spec/omniauth-ldap/adaptor_spec.rb +15 -0
- data/spec/omniauth/strategies/polaris_spec.rb +83 -0
- data/spec/spec_helper.rb +13 -0
- metadata +154 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 782f2fe5ef9e563de8acb9bc4bc40514d868fa06
|
4
|
+
data.tar.gz: 72d665983d951640d341aa4328a3213829237d98
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fcf55973229e7642569371ca24ddc023263998d274a41bdd905823d130d5ae10d528f8718651e5358e82ec4ba6366b777805d68bd643d23f8ba701a03042bf87
|
7
|
+
data.tar.gz: bb794c07c75c09ad7461c1959dfffbb14776b54bbe059ddf2a751edb6cb9e52a9fa45bbc97ca10e32906721ea6a63df5b58cf58e5a0451428dff1ae1418b1349
|
data/.gitignore
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# Generated by default by Github #
|
2
|
+
##################################
|
3
|
+
*.rbc
|
4
|
+
*.sassc
|
5
|
+
.sass-cache
|
6
|
+
capybara-*.html
|
7
|
+
.rspec
|
8
|
+
/.bundle
|
9
|
+
/vendor/bundle
|
10
|
+
/log/*
|
11
|
+
/tmp/*
|
12
|
+
/db/*.sqlite3
|
13
|
+
/public/system/*
|
14
|
+
/coverage/
|
15
|
+
/spec/tmp/*
|
16
|
+
**.orig
|
17
|
+
rerun.txt
|
18
|
+
pickle-email-*.html
|
19
|
+
|
20
|
+
# Specific configuration files #
|
21
|
+
################################
|
22
|
+
hydra-ldap.yml
|
23
|
+
database.yml
|
24
|
+
fedora.yml
|
25
|
+
solr.yml
|
26
|
+
role_map_cucumber.yml
|
27
|
+
role_map_development.yml
|
28
|
+
role_map_production.yml
|
29
|
+
role_map_test.yml
|
30
|
+
|
31
|
+
# Files to ignore by default in Git #
|
32
|
+
#####################################
|
33
|
+
*.pdf
|
34
|
+
*.db
|
35
|
+
*.jar
|
36
|
+
*.gz
|
37
|
+
*.tar
|
38
|
+
*.zip
|
39
|
+
*.dll
|
40
|
+
*.sqlite
|
41
|
+
*.sql
|
42
|
+
|
43
|
+
# Specific Files to ignore #
|
44
|
+
############################
|
45
|
+
Thumbs.db
|
46
|
+
Icon?
|
47
|
+
.DS_Store?
|
48
|
+
.DS_Store
|
49
|
+
ehthumbs.db
|
50
|
+
.idea # Rubymine config files
|
51
|
+
/.idea/*
|
52
|
+
|
53
|
+
# Directories to ignore #
|
54
|
+
#########################
|
55
|
+
/public/data/*
|
56
|
+
/jetty/*
|
57
|
+
/solr_conf/*
|
58
|
+
/fedora_conf/*
|
59
|
+
|
60
|
+
# Ignore edited Linux files #
|
61
|
+
#############################
|
62
|
+
|
63
|
+
*~
|
data/Gemfile
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'rails', '3.2.9'
|
4
|
+
|
5
|
+
# Bundle edge Rails instead:
|
6
|
+
# gem 'rails', :git => 'git://github.com/rails/rails.git'
|
7
|
+
|
8
|
+
gem 'sqlite3'
|
9
|
+
|
10
|
+
|
11
|
+
# Gems used only for assets and not required
|
12
|
+
# in production environments by default.
|
13
|
+
group :assets do
|
14
|
+
gem 'sass-rails', '~> 3.2.3'
|
15
|
+
gem 'coffee-rails', '~> 3.2.1'
|
16
|
+
|
17
|
+
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
18
|
+
# gem 'therubyracer', :platforms => :ruby
|
19
|
+
|
20
|
+
gem 'uglifier', '>= 1.0.3'
|
21
|
+
end
|
22
|
+
|
23
|
+
gem 'jquery-rails'
|
24
|
+
|
25
|
+
# To use ActiveModel has_secure_password
|
26
|
+
# gem 'bcrypt-ruby', '~> 3.0.0'
|
27
|
+
|
28
|
+
# To use Jbuilder templates for JSON
|
29
|
+
# gem 'jbuilder'
|
30
|
+
|
31
|
+
# Use unicorn as the app server
|
32
|
+
# gem 'unicorn'
|
33
|
+
|
34
|
+
# Deploy with Capistrano
|
35
|
+
# gem 'capistrano'
|
36
|
+
|
37
|
+
# To use debugger
|
38
|
+
# gem 'debugger'
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
3
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
4
|
+
|
5
|
+
require File.expand_path('../config/application', __FILE__)
|
6
|
+
|
7
|
+
OmniauthPolaris::Application.load_tasks
|
@@ -0,0 +1,100 @@
|
|
1
|
+
require 'base64'
|
2
|
+
require 'cgi'
|
3
|
+
require 'openssl'
|
4
|
+
require 'rest_client'
|
5
|
+
|
6
|
+
module OmniAuth
|
7
|
+
module Polaris
|
8
|
+
class Adaptor
|
9
|
+
class PolarisError < StandardError; end
|
10
|
+
class ConfigurationError < StandardError; end
|
11
|
+
class AuthenticationError < StandardError; end
|
12
|
+
class ConnectionError < StandardError; end
|
13
|
+
|
14
|
+
VALID_ADAPTER_CONFIGURATION_KEYS = [:access_id, :access_key, :method, :http_uri]
|
15
|
+
|
16
|
+
MUST_HAVE_KEYS = [:access_id, :access_key, :method, :http_uri]
|
17
|
+
|
18
|
+
METHOD = {
|
19
|
+
:GET => :GET
|
20
|
+
}
|
21
|
+
|
22
|
+
attr_reader :config
|
23
|
+
|
24
|
+
def self.validate(configuration={})
|
25
|
+
message = []
|
26
|
+
MUST_HAVE_KEYS.each do |name|
|
27
|
+
message << name if configuration[name].nil?
|
28
|
+
end
|
29
|
+
raise ArgumentError.new(message.join(",") +" MUST be provided") unless message.empty?
|
30
|
+
end
|
31
|
+
|
32
|
+
def initialize(configuration={})
|
33
|
+
Adaptor.validate(configuration)
|
34
|
+
@configuration = configuration.dup
|
35
|
+
@logger = @configuration.delete(:logger)
|
36
|
+
VALID_ADAPTER_CONFIGURATION_KEYS.each do |name|
|
37
|
+
instance_variable_set("@#{name}", @configuration[name])
|
38
|
+
end
|
39
|
+
|
40
|
+
@config = {
|
41
|
+
:http_uri => @http_uri,
|
42
|
+
:method => @method,
|
43
|
+
:access_key => @access_key,
|
44
|
+
:access_id => @access_id
|
45
|
+
}
|
46
|
+
|
47
|
+
method = ensure_method(@method)
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
public
|
52
|
+
def bind_as(args = {})
|
53
|
+
response = false
|
54
|
+
|
55
|
+
#Basic shared input variables
|
56
|
+
pin = args[:pin]
|
57
|
+
barcode = args[:barcode]
|
58
|
+
http_date = Time.now.in_time_zone("GMT").strftime("%a, %d %b %Y %H:%M:%S %Z")
|
59
|
+
|
60
|
+
#Authorization hash component
|
61
|
+
http_uri_with_barcode = @http_uri + barcode
|
62
|
+
concated_string = @method + @http_uri + barcode + http_date + pin
|
63
|
+
sha1_sig = Base64.strict_encode64("#{OpenSSL::HMAC.digest('sha1',@access_key, concated_string)}")
|
64
|
+
xml_response = RestClient.get http_uri_with_barcode, {'PolarisDate' => http_date, 'Authorization' => "PWS " + @access_id + ":" + sha1_sig}
|
65
|
+
authorization_response = Hash.from_xml xml_response
|
66
|
+
|
67
|
+
#Details hash component
|
68
|
+
http_basic_data_get = @http_uri + barcode + '/basicdata'
|
69
|
+
concated_string = @method + http_basic_data_get + http_date + pin
|
70
|
+
sha1_sig = Base64.strict_encode64("#{OpenSSL::HMAC.digest('sha1',@access_key, concated_string)}")
|
71
|
+
xml_response = RestClient.get http_basic_data_get, {'PolarisDate' => http_date, 'Authorization' => "PWS " + @access_id + ":" + sha1_sig}
|
72
|
+
details_response = Hash.from_xml xml_response
|
73
|
+
|
74
|
+
#Add some of the basic details to a single hash, using the authorization as the base.
|
75
|
+
authorization_response["PatronValidateResult"]["NameFirst"] = details_response["PatronBasicDataGetResult"]["PatronBasicData"]["NameFirst"]
|
76
|
+
authorization_response["PatronValidateResult"]["NameLast"] = details_response["PatronBasicDataGetResult"]["PatronBasicData"]["NameLast"]
|
77
|
+
authorization_response["PatronValidateResult"]["NameMiddle"] = details_response["PatronBasicDataGetResult"]["PatronBasicData"]["NameMiddle"]
|
78
|
+
authorization_response["PatronValidateResult"]["PhoneNumber"] = details_response["PatronBasicDataGetResult"]["PatronBasicData"]["PhoneNumber"]
|
79
|
+
authorization_response["PatronValidateResult"]["EmailAddress"] = details_response["PatronBasicDataGetResult"]["PatronBasicData"]["EmailAddress"]
|
80
|
+
|
81
|
+
authorization_response["PatronValidateResult"]
|
82
|
+
end
|
83
|
+
|
84
|
+
private
|
85
|
+
def ensure_method(method)
|
86
|
+
method ||= "get"
|
87
|
+
normalized_method = method.to_s.upcase.to_sym
|
88
|
+
return METHOD[normalized_method] if METHOD.has_key?(normalized_method)
|
89
|
+
|
90
|
+
available_methods = METHOD.keys.collect {|m| m.inspect}.join(", ")
|
91
|
+
format = "%s is not one of the available connect methods: %s"
|
92
|
+
raise ConfigurationError, format % [method.inspect, available_methods]
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
require 'omniauth'
|
2
|
+
|
3
|
+
|
4
|
+
module OmniAuth
|
5
|
+
module Strategies
|
6
|
+
class Polaris
|
7
|
+
class MissingCredentialsError < StandardError; end
|
8
|
+
include OmniAuth::Strategy
|
9
|
+
@@config = {
|
10
|
+
'barcode' => 'Barcode',
|
11
|
+
'valid_patron' => 'ValidPatron',
|
12
|
+
'patron_id' => 'PatronID',
|
13
|
+
'assigned_branch_id' => 'AssignedBranchID',
|
14
|
+
'assigned_branch_name' => 'AssignedBranchName',
|
15
|
+
'first_name' => 'NameFirst',
|
16
|
+
'last_name' => 'NameLast',
|
17
|
+
'middle_name' => 'NameMiddle',
|
18
|
+
'phone_number' => 'PhoneNumber',
|
19
|
+
'email' => 'EmailAddress'
|
20
|
+
}
|
21
|
+
option :title, "Polaris Authentication" #default title for authentication form
|
22
|
+
|
23
|
+
|
24
|
+
def request_phase
|
25
|
+
OmniAuth::Polaris::Adaptor.validate @options
|
26
|
+
f = OmniAuth::Form.new(:title => (options[:title] || "Polaris Authentication"), :url => callback_path)
|
27
|
+
f.text_field 'Barcode', 'barcode'
|
28
|
+
f.password_field 'PIN', 'pin'
|
29
|
+
f.button "Sign In"
|
30
|
+
f.to_response
|
31
|
+
end
|
32
|
+
|
33
|
+
def callback_phase
|
34
|
+
@adaptor = OmniAuth::Polaris::Adaptor.new @options
|
35
|
+
|
36
|
+
raise MissingCredentialsError.new("Missing login credentials") if request['barcode'].nil? || request['pin'].nil?
|
37
|
+
begin
|
38
|
+
@polaris_user_info = @adaptor.bind_as(:barcode => request['barcode'], :pin => request['pin'])
|
39
|
+
return fail!(:invalid_credentials) if !@polaris_user_info
|
40
|
+
|
41
|
+
@user_info = self.class.map_user(@@config, @polaris_user_info)
|
42
|
+
super
|
43
|
+
rescue Exception => e
|
44
|
+
return fail!(:polaris_error, e)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
uid {
|
49
|
+
request['barcode']
|
50
|
+
}
|
51
|
+
info {
|
52
|
+
@user_info
|
53
|
+
}
|
54
|
+
extra {
|
55
|
+
{ :raw_info => @polaris_user_info }
|
56
|
+
}
|
57
|
+
|
58
|
+
def map_user(mapper, object)
|
59
|
+
|
60
|
+
user = {}
|
61
|
+
mapper.each do |key, value|
|
62
|
+
case value
|
63
|
+
when String
|
64
|
+
#user[key] = object[value.downcase.to_sym].first if object[value.downcase.to_sym]
|
65
|
+
user[key.to_sym] = object[value] if object[value]
|
66
|
+
when Array
|
67
|
+
#value.each {|v| (user[key] = object[v.downcase.to_sym].first; break;) if object[v.downcase.to_sym]}
|
68
|
+
value.each {|v| (user[key] = object[v.downcase.to_sym]; break;) if object[v.downcase.to_sym]}
|
69
|
+
when Hash
|
70
|
+
value.map do |key1, value1|
|
71
|
+
pattern = key1.dup
|
72
|
+
value1.each_with_index do |v,i|
|
73
|
+
#part = ''; v.collect(&:downcase).collect(&:to_sym).each {|v1| (part = object[v1].first; break;) if object[v1]}
|
74
|
+
part = ''; v.collect(&:downcase).collect(&:to_sym).each {|v1| (part = object[v1]; break;) if object[v1]}
|
75
|
+
pattern.gsub!("%#{i}",part||'')
|
76
|
+
end
|
77
|
+
user[key] = pattern
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
user
|
82
|
+
end
|
83
|
+
|
84
|
+
|
85
|
+
def self.map_user(mapper, object)
|
86
|
+
|
87
|
+
user = {}
|
88
|
+
mapper.each do |key, value|
|
89
|
+
case value
|
90
|
+
when String
|
91
|
+
#user[key] = object[value.downcase.to_sym].first if object[value.downcase.to_sym]
|
92
|
+
user[key.to_sym] = object[value] if object[value]
|
93
|
+
when Array
|
94
|
+
#value.each {|v| (user[key] = object[v.downcase.to_sym].first; break;) if object[v.downcase.to_sym]}
|
95
|
+
value.each {|v| (user[key] = object[v.downcase.to_sym]; break;) if object[v.downcase.to_sym]}
|
96
|
+
when Hash
|
97
|
+
value.map do |key1, value1|
|
98
|
+
pattern = key1.dup
|
99
|
+
value1.each_with_index do |v,i|
|
100
|
+
#part = ''; v.collect(&:downcase).collect(&:to_sym).each {|v1| (part = object[v1].first; break;) if object[v1]}
|
101
|
+
part = ''; v.collect(&:downcase).collect(&:to_sym).each {|v1| (part = object[v1]; break;) if object[v1]}
|
102
|
+
pattern.gsub!("%#{i}",part||'')
|
103
|
+
end
|
104
|
+
user[key] = pattern
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
user
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
OmniAuth.config.add_camelization 'polaris', 'Polaris'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/omniauth-polaris/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Steven Anderson"]
|
6
|
+
gem.email = ["sanderson@bpl.org"]
|
7
|
+
gem.description = %q{A Polaris API strategy for OmniAuth.}
|
8
|
+
gem.summary = %q{A Polaris API strategy for OmniAuth.}
|
9
|
+
gem.homepage = "https://github.com/boston-library/omniauth-polaris"
|
10
|
+
|
11
|
+
gem.add_runtime_dependency 'omniauth', '~> 1.0'
|
12
|
+
gem.add_runtime_dependency 'rest-client', '~> 1.6.7'
|
13
|
+
gem.add_development_dependency 'rspec', '~> 2.7'
|
14
|
+
gem.add_development_dependency 'simplecov'
|
15
|
+
gem.add_development_dependency 'rack-test'
|
16
|
+
gem.add_development_dependency 'libnotify'
|
17
|
+
gem.add_development_dependency 'ruby-debug19'
|
18
|
+
|
19
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
gem.files = `git ls-files`.split("\n")
|
21
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
22
|
+
gem.name = "omniauth-polaris"
|
23
|
+
gem.require_paths = ["lib"]
|
24
|
+
gem.version = OmniAuth::Polaris::VERSION
|
25
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
describe "OmniAuth::Polaris::Adaptor" do
|
3
|
+
|
4
|
+
describe 'initialize' do
|
5
|
+
it 'should throw exception when must have field is not set' do
|
6
|
+
#[:host, :port, :method, :bind_dn]
|
7
|
+
lambda { OmniAuth::Polaris::Adaptor.new({http_uri: "http://blah.org/PAPIService/REST/public/v1/1000/100/1/patron/", method: 'GET'})}.should raise_error(ArgumentError)
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should throw exception when method is not supported' do
|
11
|
+
lambda { OmniAuth::Polaris::Adaptor.new({http_uri: "http://blah.org/PAPIService/REST/public/v1/1000/100/1/patron/", method: 'POST', access_key: 'F9998888-A000-1111-C22C-CC3333BB4444', access_id: 'API'})}.should raise_error(OmniAuth::Polaris::Adaptor::ConfigurationError)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
describe "OmniAuth::Strategies::Polaris" do
|
3
|
+
|
4
|
+
|
5
|
+
class MyPolarisProvider < OmniAuth::Strategies::Polaris; end
|
6
|
+
def app
|
7
|
+
Rack::Builder.new {
|
8
|
+
use OmniAuth::Test::PhonySession
|
9
|
+
use MyPolarisProvider, :name => 'polaris', :title => 'MyPolaris Form', :http_uri => 'http://blah.org/PAPIService/REST/public/v1/1000/100/1/patron/', :access_key => 'F9998888-A000-1111-C22C-CC3333BB4444', :access_id => 'API', :method => 'GET'
|
10
|
+
run lambda { |env| [404, {'Content-Type' => 'text/plain'}, [env.key?('omniauth.auth').to_s]] }
|
11
|
+
}.to_app
|
12
|
+
end
|
13
|
+
|
14
|
+
def session
|
15
|
+
last_request.env['rack.session']
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should add a camelization for itself' do
|
19
|
+
OmniAuth::Utils.camelize('polaris').should == 'Polaris'
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '/auth/polaris' do
|
23
|
+
before(:each){ get '/auth/polaris' }
|
24
|
+
|
25
|
+
it 'should display a form' do
|
26
|
+
last_response.status.should == 200
|
27
|
+
last_response.body.should be_include("<form")
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should have the callback as the action for the form' do
|
31
|
+
last_response.body.should be_include("action='/auth/polaris/callback'")
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should have a text field for each of the fields' do
|
35
|
+
last_response.body.scan('<input').size.should == 2
|
36
|
+
end
|
37
|
+
it 'should have a label of the form title' do
|
38
|
+
last_response.body.scan('MyPolaris Form').size.should > 1
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
describe 'post /auth/polaris/callback' do
|
44
|
+
before(:each) do
|
45
|
+
@adaptor = mock(OmniAuth::Polaris::Adaptor, {:barcode => '29999999999999'})
|
46
|
+
OmniAuth::Polaris::Adaptor.stub(:new).and_return(@adaptor)
|
47
|
+
end
|
48
|
+
context 'failure' do
|
49
|
+
before(:each) do
|
50
|
+
@adaptor.stub(:bind_as).and_return(false)
|
51
|
+
end
|
52
|
+
it 'should raise MissingCredentialsError' do
|
53
|
+
lambda{post('/auth/polaris/callback', {})}.should raise_error OmniAuth::Strategies::Polaris::MissingCredentialsError
|
54
|
+
end
|
55
|
+
it 'should redirect to error page' do
|
56
|
+
post('/auth/polaris/callback', {:barcode => 'ping', :pin => 'password'})
|
57
|
+
last_response.should be_redirect
|
58
|
+
last_response.headers['Location'].should =~ %r{invalid_credentials}
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
context 'success' do
|
63
|
+
let(:auth_hash){ last_request.env['omniauth.auth'] }
|
64
|
+
before(:each) do
|
65
|
+
@adaptor.stub(:bind_as).and_return({:PAPIErrorCode => "0", :barcode => '29999999999999', :ValidPatron => 'true', :PatronID => '111111', :PatronCodeID => '27',
|
66
|
+
:AssignedBranchID => '3', :PatronBarcode => '29999999999999', :AssignedBranchName => 'BPL - Central', :ExpirationDate => '2015-09-20T00:00:00', :OverridePasswordUsed =>'false'})
|
67
|
+
#
|
68
|
+
post('/auth/polaris/callback', {:barcode => '29999021413588', :pin => '0407'})
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'should raise MissingCredentialsError' do
|
72
|
+
should_not raise_error OmniAuth::Strategies::Polaris::MissingCredentialsError
|
73
|
+
end
|
74
|
+
it 'should map user info' do
|
75
|
+
auth_hash.info.barcode.should == '29999999999999'
|
76
|
+
auth_hash.info.valid_patron.should == 'true'
|
77
|
+
auth_hash.info.patron_id.should == '111111'
|
78
|
+
auth_hash.info.assigned_branch_id.should == '3'
|
79
|
+
auth_hash.info.assigned_branch_name.should == 'BPL - Central'
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
$:.unshift File.expand_path('..', __FILE__)
|
2
|
+
$:.unshift File.expand_path('../../lib', __FILE__)
|
3
|
+
require 'simplecov'
|
4
|
+
SimpleCov.start
|
5
|
+
require 'rspec'
|
6
|
+
require 'rack/test'
|
7
|
+
require 'omniauth'
|
8
|
+
require 'omniauth-polaris'
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
config.include Rack::Test::Methods
|
12
|
+
config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
|
13
|
+
end
|
metadata
ADDED
@@ -0,0 +1,154 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-polaris
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Steven Anderson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-06-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: omniauth
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rest-client
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.6.7
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.6.7
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.7'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: simplecov
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
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: rack-test
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: libnotify
|
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: ruby-debug19
|
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
|
+
description: A Polaris API strategy for OmniAuth.
|
112
|
+
email:
|
113
|
+
- sanderson@bpl.org
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- .gitignore
|
119
|
+
- Gemfile
|
120
|
+
- README.rdoc
|
121
|
+
- Rakefile
|
122
|
+
- lib/omniauth-polaris.rb
|
123
|
+
- lib/omniauth-polaris/adaptor.rb
|
124
|
+
- lib/omniauth-polaris/version.rb
|
125
|
+
- lib/omniauth/strategies/polaris.rb
|
126
|
+
- omniauth-polaris.gemspec
|
127
|
+
- spec/omniauth-ldap/adaptor_spec.rb
|
128
|
+
- spec/omniauth/strategies/polaris_spec.rb
|
129
|
+
- spec/spec_helper.rb
|
130
|
+
homepage: https://github.com/boston-library/omniauth-polaris
|
131
|
+
licenses: []
|
132
|
+
metadata: {}
|
133
|
+
post_install_message:
|
134
|
+
rdoc_options: []
|
135
|
+
require_paths:
|
136
|
+
- lib
|
137
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - '>='
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
requirements: []
|
148
|
+
rubyforge_project:
|
149
|
+
rubygems_version: 2.0.3
|
150
|
+
signing_key:
|
151
|
+
specification_version: 4
|
152
|
+
summary: A Polaris API strategy for OmniAuth.
|
153
|
+
test_files: []
|
154
|
+
has_rdoc:
|