omniauth-shibboleth 1.0.6 → 1.0.7
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/Gemfile.lock +35 -0
- data/README.md +15 -6
- data/lib/omniauth-shibboleth/version.rb +1 -1
- data/lib/omniauth/strategies/shibboleth.rb +12 -13
- data/omniauth-shibboleth.gemspec +2 -2
- data/spec/omniauth/strategies/shibboleth_spec.rb +9 -6
- metadata +40 -13
data/Gemfile.lock
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
omniauth-shibboleth (1.0.7)
|
5
|
+
omniauth (>= 1.0.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
diff-lcs (1.1.3)
|
11
|
+
hashie (1.2.0)
|
12
|
+
omniauth (1.1.1)
|
13
|
+
hashie (~> 1.2)
|
14
|
+
rack
|
15
|
+
rack (1.4.1)
|
16
|
+
rack-test (0.6.1)
|
17
|
+
rack (>= 1.0)
|
18
|
+
rake (0.9.2.2)
|
19
|
+
rspec (2.11.0)
|
20
|
+
rspec-core (~> 2.11.0)
|
21
|
+
rspec-expectations (~> 2.11.0)
|
22
|
+
rspec-mocks (~> 2.11.0)
|
23
|
+
rspec-core (2.11.1)
|
24
|
+
rspec-expectations (2.11.3)
|
25
|
+
diff-lcs (~> 1.1.3)
|
26
|
+
rspec-mocks (2.11.2)
|
27
|
+
|
28
|
+
PLATFORMS
|
29
|
+
ruby
|
30
|
+
|
31
|
+
DEPENDENCIES
|
32
|
+
omniauth-shibboleth!
|
33
|
+
rack-test
|
34
|
+
rake
|
35
|
+
rspec (~> 2.8)
|
data/README.md
CHANGED
@@ -35,6 +35,9 @@ To use OmniAuth Shibboleth strategy as a middleware in your rails application, a
|
|
35
35
|
% vi config/initializer/omniauth.rb
|
36
36
|
Rails.application.config.middleware.use OmniAuth::Builder do
|
37
37
|
provider :shibboleth, {
|
38
|
+
:shib_session_id_field => "Shib-Session-ID",
|
39
|
+
:shib_application_id_field => "Shib-Application-ID",
|
40
|
+
:debug => false,
|
38
41
|
:extra_fields => [
|
39
42
|
:"unscoped-affiliation",
|
40
43
|
:entitlement
|
@@ -46,15 +49,21 @@ In the above example, 'unscoped-affiliation' and 'entitlement' attributes are ad
|
|
46
49
|
|
47
50
|
https://github.com/intridea/omniauth/wiki/Auth-Hash-Schema
|
48
51
|
|
49
|
-
'eppn' attribute is used as uid field. 'displayName'
|
52
|
+
'eppn' attribute is used as uid field. 'displayName' attribute is provided as request.env["omniauth.auth"]["info"]["name"].
|
50
53
|
|
51
|
-
These can be changed by :uid_field
|
54
|
+
These can be changed by :uid_field, :name_field option. You can also add any "info" fields defined in Auth-Hash-Schema by using :info_fields option.
|
52
55
|
|
53
56
|
% vi config/initializer/omniauth.rb
|
54
57
|
Rails.application.config.middleware.use OmniAuth::Builder do
|
55
58
|
provider :shibboleth, {
|
56
|
-
:uid_field
|
57
|
-
:
|
59
|
+
:uid_field => "uid",
|
60
|
+
:name_field => "displayName",
|
61
|
+
:info_fields => {
|
62
|
+
:email => "mail",
|
63
|
+
:location => "contactAddress",
|
64
|
+
:image => "photo_url",
|
65
|
+
:phone => "contactPhone"
|
66
|
+
}
|
58
67
|
}
|
59
68
|
end
|
60
69
|
|
@@ -84,7 +93,7 @@ https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPSpoofChecking
|
|
84
93
|
|
85
94
|
To provide Shibboleth attributes via environment variables, we can not use proxy_balancer base approach. Currently we can realize it by using Phusion Passenger as an application container. An example construction pattern is shown in presence_checker application (https://github.com/toyokazu/presence_checker/).
|
86
95
|
|
87
|
-
###
|
96
|
+
### debug mode
|
88
97
|
|
89
98
|
When you deploy a new application, you may want to confirm the assumed attributes are correctly provided by Shibboleth SP. OmniAuth Shibboleth strategy provides a confirmation option :debug. If you set :debug true, you can see the environment variables provided at the /auth/shibboleth/callback uri.
|
90
99
|
|
@@ -95,7 +104,7 @@ When you deploy a new application, you may want to confirm the assumed attribute
|
|
95
104
|
|
96
105
|
## License (MIT License)
|
97
106
|
|
98
|
-
Copyright (C) 2011 by Toyokazu Akiyama.
|
107
|
+
Copyright (C) 2011-2012 by Toyokazu Akiyama.
|
99
108
|
|
100
109
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
101
110
|
of this software and associated documentation files (the "Software"), to deal
|
@@ -3,8 +3,11 @@ module OmniAuth
|
|
3
3
|
class Shibboleth
|
4
4
|
include OmniAuth::Strategy
|
5
5
|
|
6
|
-
option :
|
7
|
-
option :
|
6
|
+
option :shib_session_id_field, 'Shib-Session-ID'
|
7
|
+
option :shib_application_id_field, 'Shib-Application-ID'
|
8
|
+
option :uid_field, 'eppn'
|
9
|
+
option :name_field, 'displayName'
|
10
|
+
option :info_fields, {}
|
8
11
|
option :extra_fields, []
|
9
12
|
option :debug, false
|
10
13
|
|
@@ -30,7 +33,7 @@ module OmniAuth
|
|
30
33
|
[request.env.sort.map {|i| "#{i[0]}: #{i[1]}" }.join("\n")]
|
31
34
|
]
|
32
35
|
end
|
33
|
-
return fail!(:no_shibboleth_session) unless (request.env[
|
36
|
+
return fail!(:no_shibboleth_session) unless (request.env[options.shib_session_id_field.to_s] || request.env[options.shib_application_id_field.to_s])
|
34
37
|
super
|
35
38
|
end
|
36
39
|
|
@@ -39,17 +42,13 @@ module OmniAuth
|
|
39
42
|
end
|
40
43
|
|
41
44
|
info do
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
hash[field] = request.env['mail']
|
48
|
-
else
|
49
|
-
hash[field] = request.env[field.to_s]
|
50
|
-
end
|
51
|
-
hash
|
45
|
+
res = {
|
46
|
+
:name => request.env[options.name_field.to_s]
|
47
|
+
}
|
48
|
+
options.info_fields.each_pair do |k,v|
|
49
|
+
res[k] = request.env[v.to_s]
|
52
50
|
end
|
51
|
+
res
|
53
52
|
end
|
54
53
|
|
55
54
|
extra do
|
data/omniauth-shibboleth.gemspec
CHANGED
@@ -10,8 +10,8 @@ Gem::Specification.new do |gem|
|
|
10
10
|
|
11
11
|
gem.authors = ["Toyokazu Akiyama"]
|
12
12
|
gem.email = ["toyokazu@gmail.com"]
|
13
|
-
gem.description = %q{OmniAuth Shibboleth strategies for OmniAuth 1.
|
14
|
-
gem.summary = %q{OmniAuth Shibboleth strategies for OmniAuth 1.
|
13
|
+
gem.description = %q{OmniAuth Shibboleth strategies for OmniAuth 1.x}
|
14
|
+
gem.summary = %q{OmniAuth Shibboleth strategies for OmniAuth 1.x}
|
15
15
|
gem.homepage = ""
|
16
16
|
|
17
17
|
gem.files = `find . -not \\( -regex ".*\\.git.*" -o -regex "\\./pkg.*" -o -regex "\\./spec.*" \\)`.split("\n").map{ |f| f.gsub(/^.\//, '') }
|
@@ -54,16 +54,20 @@ describe OmniAuth::Strategies::Shibboleth do
|
|
54
54
|
@dummy_id = 'abcdefg'
|
55
55
|
@eppn = 'test@example.com'
|
56
56
|
@display_name = 'Test User'
|
57
|
-
@
|
58
|
-
strategy.call!(make_env('/auth/shibboleth/callback', 'Shib-Session-ID' => @dummy_id, 'eppn' => @eppn, 'displayName' => @display_name, 'mail' => @email))
|
57
|
+
strategy.call!(make_env('/auth/shibboleth/callback', 'Shib-Session-ID' => @dummy_id, 'eppn' => @eppn, 'displayName' => @display_name))
|
59
58
|
strategy.env['omniauth.auth']['uid'].should == @eppn
|
60
59
|
strategy.env['omniauth.auth']['info']['name'].should == @display_name
|
61
|
-
strategy.env['omniauth.auth']['info']['email'].should == @email
|
62
60
|
end
|
63
61
|
end
|
64
62
|
|
65
63
|
context 'with Shibboleth session and attribute options' do
|
66
|
-
let(:options){ {
|
64
|
+
let(:options){ {
|
65
|
+
:shib_session_id_field => 'Shib-Session-ID',
|
66
|
+
:shib_application_id_field => 'Shib-Application-ID',
|
67
|
+
:uid_field => :uid,
|
68
|
+
:name_field => :displayName,
|
69
|
+
:info_fields => {},
|
70
|
+
:extra_fields => [:o, :affiliation] } }
|
67
71
|
let(:app){ lambda{|env| [404, {}, ['Awesome']]}}
|
68
72
|
let(:strategy){ OmniAuth::Strategies::Shibboleth.new(app, options) }
|
69
73
|
|
@@ -86,8 +90,7 @@ describe OmniAuth::Strategies::Shibboleth do
|
|
86
90
|
@dummy_id = 'abcdefg'
|
87
91
|
@eppn = 'test@example.com'
|
88
92
|
@display_name = 'Test User'
|
89
|
-
|
90
|
-
env = make_env('/auth/shibboleth/callback', 'Shib-Session-ID' => @dummy_id, 'eppn' => @eppn, 'displayName' => @display_name, 'mail' => @email)
|
93
|
+
env = make_env('/auth/shibboleth/callback', 'Shib-Session-ID' => @dummy_id, 'eppn' => @eppn, 'displayName' => @display_name)
|
91
94
|
response = strategy.call!(env)
|
92
95
|
response[0].should == 200
|
93
96
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-shibboleth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: 1.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.0.0
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: rack-test
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: rake
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,10 +53,15 @@ dependencies:
|
|
43
53
|
version: '0'
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: rspec
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ~>
|
@@ -54,8 +69,13 @@ dependencies:
|
|
54
69
|
version: '2.8'
|
55
70
|
type: :development
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
58
|
-
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '2.8'
|
78
|
+
description: OmniAuth Shibboleth strategies for OmniAuth 1.x
|
59
79
|
email:
|
60
80
|
- toyokazu@gmail.com
|
61
81
|
executables: []
|
@@ -63,6 +83,7 @@ extensions: []
|
|
63
83
|
extra_rdoc_files: []
|
64
84
|
files:
|
65
85
|
- Gemfile
|
86
|
+
- Gemfile.lock
|
66
87
|
- lib/omniauth/strategies/shibboleth.rb
|
67
88
|
- lib/omniauth-shibboleth/version.rb
|
68
89
|
- lib/omniauth-shibboleth.rb
|
@@ -83,18 +104,24 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
83
104
|
- - ! '>='
|
84
105
|
- !ruby/object:Gem::Version
|
85
106
|
version: '0'
|
107
|
+
segments:
|
108
|
+
- 0
|
109
|
+
hash: -3085900571959880599
|
86
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
111
|
none: false
|
88
112
|
requirements:
|
89
113
|
- - ! '>='
|
90
114
|
- !ruby/object:Gem::Version
|
91
115
|
version: '0'
|
116
|
+
segments:
|
117
|
+
- 0
|
118
|
+
hash: -3085900571959880599
|
92
119
|
requirements: []
|
93
120
|
rubyforge_project:
|
94
|
-
rubygems_version: 1.8.
|
121
|
+
rubygems_version: 1.8.24
|
95
122
|
signing_key:
|
96
123
|
specification_version: 3
|
97
|
-
summary: OmniAuth Shibboleth strategies for OmniAuth 1.
|
124
|
+
summary: OmniAuth Shibboleth strategies for OmniAuth 1.x
|
98
125
|
test_files:
|
99
126
|
- spec/omniauth/strategies/shibboleth_spec.rb
|
100
127
|
- spec/spec_helper.rb
|