rack-federated-auth 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,51 @@
1
+ .rbenv*
2
+
3
+ # rcov generated
4
+ coverage
5
+ coverage.data
6
+
7
+ # rdoc generated
8
+ rdoc
9
+
10
+ # yard generated
11
+ doc
12
+ .yardoc
13
+
14
+ # bundler
15
+ .bundle
16
+
17
+ # jeweler generated
18
+ pkg
19
+
20
+ # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
21
+ #
22
+ # * Create a file at ~/.gitignore
23
+ # * Include files you want ignored
24
+ # * Run: git config --global core.excludesfile ~/.gitignore
25
+ #
26
+ # After doing this, these files will be ignored in all your git projects,
27
+ # saving you from having to 'pollute' every project you touch with them
28
+ #
29
+ # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
30
+ #
31
+ # For MacOS:
32
+ #
33
+ #.DS_Store
34
+
35
+ # For TextMate
36
+ #*.tmproj
37
+ #tmtags
38
+
39
+ # For emacs:
40
+ #*~
41
+ #\#*
42
+ #.\#*
43
+
44
+ # For vim:
45
+ #*.swp
46
+
47
+ # For redcar:
48
+ #.redcar
49
+
50
+ # For rubinius:
51
+ #*.rbc
data/Gemfile CHANGED
@@ -1,15 +1,3 @@
1
1
  source "http://rubygems.org"
2
- # Add dependencies required to use your gem here.
3
- # Example:
4
- # gem "activesupport", ">= 2.3.5"
5
2
 
6
- gem "omniauth"
7
-
8
- # Add dependencies to develop your gem here.
9
- # Include everything needed to run rake, tests, features, etc.
10
- group :development do
11
- gem "shoulda", ">= 0"
12
- gem "rdoc", "~> 3.12"
13
- gem "bundler", "~> 1.0.0"
14
- gem "jeweler", "~> 1.8.3"
15
- end
3
+ gemspec
data/Gemfile.lock CHANGED
@@ -1,19 +1,21 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rack-federated-auth (0.2.1)
5
+ omniauth
6
+ sinatra
7
+
1
8
  GEM
2
9
  remote: http://rubygems.org/
3
10
  specs:
4
- git (1.2.5)
5
- hashie (1.2.0)
6
- jeweler (1.8.3)
7
- bundler (~> 1.0)
8
- git (>= 1.2.5)
9
- rake
10
- rdoc
11
+ hashie (2.0.5)
11
12
  json (1.6.5)
12
- omniauth (1.0.3)
13
- hashie (~> 1.2)
13
+ omniauth (1.1.4)
14
+ hashie (>= 1.2, < 3)
15
+ rack
16
+ rack (1.5.2)
17
+ rack-protection (1.5.0)
14
18
  rack
15
- rack (1.4.1)
16
- rake (0.9.2.2)
17
19
  rdoc (3.12)
18
20
  json (~> 1.4)
19
21
  shoulda (3.0.1)
@@ -21,13 +23,17 @@ GEM
21
23
  shoulda-matchers (~> 1.0.0)
22
24
  shoulda-context (1.0.0)
23
25
  shoulda-matchers (1.0.0)
26
+ sinatra (1.4.3)
27
+ rack (~> 1.4)
28
+ rack-protection (~> 1.4)
29
+ tilt (~> 1.3, >= 1.3.4)
30
+ tilt (1.4.1)
24
31
 
25
32
  PLATFORMS
26
33
  ruby
27
34
 
28
35
  DEPENDENCIES
29
- bundler (~> 1.0.0)
30
- jeweler (~> 1.8.3)
31
- omniauth
36
+ bundler (~> 1.1.0)
37
+ rack-federated-auth!
32
38
  rdoc (~> 3.12)
33
39
  shoulda
data/README.md CHANGED
@@ -10,7 +10,7 @@ Install
10
10
 
11
11
  Add it to your gemfile
12
12
 
13
- gem "rack_federated_auth"
13
+ gem "rack-federated-auth"
14
14
 
15
15
  Use it in your Rack application
16
16
 
@@ -30,7 +30,7 @@ end
30
30
  ```
31
31
 
32
32
  The gem handles forwarding users to the authentication URL if they haven't authenticated,
33
- recieving the authentication callback, and setting the user's session so authentication isn't
33
+ receiving the authentication callback, and setting the user's session so authentication isn't
34
34
  required before each page request.
35
35
 
36
36
  Most federated login stragegies for OmniAuth should work - if you want to use something other than google-oauth2,
@@ -52,6 +52,22 @@ module RackFederatedAuth
52
52
  # should normalize most of that stuff.
53
53
  #
54
54
  get "/auth/:service/callback" do
55
+ authenticate!
56
+ end
57
+ put "/auth/:service/callback" do
58
+ authenticate!
59
+ end
60
+ post "/auth/:service/callback" do
61
+ authenticate!
62
+ end
63
+
64
+ get '/auth/failure' do
65
+ "<html><body>#{@failure_message}</body></html>"
66
+ end
67
+
68
+ private
69
+
70
+ def authenticate!
55
71
  puts "New #{params[:service]} auth: #{request.env['omniauth.auth']}"
56
72
  begin
57
73
  if request.env['omniauth.auth']['info']['email'].match(@email_filter)
@@ -69,12 +85,6 @@ module RackFederatedAuth
69
85
  end
70
86
  end
71
87
 
72
- get '/auth/failure' do
73
- "<html><body>#{@failure_message}</body></html>"
74
- end
75
-
76
- private
77
-
78
88
  def authenticated?
79
89
  !session[@auth_scope].nil? and session[@auth_scope]
80
90
  end
@@ -1,62 +1,23 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
1
  # -*- encoding: utf-8 -*-
5
2
 
6
- Gem::Specification.new do |s|
7
- s.name = "rack-federated-auth"
8
- s.version = "0.2.1"
3
+ Gem::Specification.new do |gem|
4
+ gem.name = "rack-federated-auth"
5
+ gem.version = "0.2.2"
6
+ gem.authors = ["Ryan Michael"]
7
+ gem.email = ["kerinin@gmail.com"]
8
+ gem.description = "Provides a simple authentication middleware to lock down Rack-based apps"
9
+ gem.summary = "Omniauth middleware"
10
+ gem.homepage = "http://github.com/otherinbox/rack-federated_auth"
9
11
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Ryan Michael"]
12
- s.date = "2012-04-03"
13
- s.description = "Provides a simple authentication middleware to lock down Rack-based apps"
14
- s.email = "kerinin@gmail.com"
15
- s.extra_rdoc_files = [
16
- "LICENSE.txt",
17
- "README.md"
18
- ]
19
- s.files = [
20
- ".document",
21
- "Gemfile",
22
- "Gemfile.lock",
23
- "LICENSE.txt",
24
- "README.md",
25
- "Rakefile",
26
- "VERSION",
27
- "lib/rack-federated-auth.rb",
28
- "rack-federated-auth.gemspec",
29
- "test/helper.rb",
30
- "test/test_rack-federated-auth.rb"
31
- ]
32
- s.homepage = "http://github.com/kerinin/rack-federated-auth"
33
- s.licenses = ["MIT"]
34
- s.require_paths = ["lib"]
35
- s.rubygems_version = "1.8.15"
36
- s.summary = "Rack middleware using for federated authentication"
12
+ gem.files = `git ls-files`.split($/)
13
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
14
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
15
+ gem.require_paths = ["lib"]
37
16
 
38
- if s.respond_to? :specification_version then
39
- s.specification_version = 3
40
-
41
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
42
- s.add_runtime_dependency(%q<omniauth>, [">= 0"])
43
- s.add_development_dependency(%q<shoulda>, [">= 0"])
44
- s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
45
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
46
- s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
47
- else
48
- s.add_dependency(%q<omniauth>, [">= 0"])
49
- s.add_dependency(%q<shoulda>, [">= 0"])
50
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
51
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
52
- s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
53
- end
54
- else
55
- s.add_dependency(%q<omniauth>, [">= 0"])
56
- s.add_dependency(%q<shoulda>, [">= 0"])
57
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
58
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
59
- s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
60
- end
17
+ gem.add_dependency 'omniauth'
18
+ gem.add_dependency 'sinatra'
19
+
20
+ gem.add_development_dependency 'shoulda'
21
+ gem.add_development_dependency 'rdoc', '~> 3.12'
22
+ gem.add_development_dependency 'bundler', '~> 1.1.0'
61
23
  end
62
-
metadata CHANGED
@@ -1,108 +1,105 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rack-federated-auth
3
- version: !ruby/object:Gem::Version
4
- hash: 21
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.2
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 1
10
- version: 0.2.1
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Ryan Michael
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-04-03 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- version_requirements: &id001 !ruby/object:Gem::Requirement
22
- none: false
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- hash: 3
27
- segments:
28
- - 0
29
- version: "0"
30
- prerelease: false
31
- requirement: *id001
12
+ date: 2013-08-09 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
32
15
  name: omniauth
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
33
22
  type: :runtime
34
- - !ruby/object:Gem::Dependency
35
- version_requirements: &id002 !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: sinatra
32
+ requirement: !ruby/object:Gem::Requirement
36
33
  none: false
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- hash: 3
41
- segments:
42
- - 0
43
- version: "0"
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
44
39
  prerelease: false
45
- requirement: *id002
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
46
47
  name: shoulda
47
- type: :development
48
- - !ruby/object:Gem::Dependency
49
- version_requirements: &id003 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
50
49
  none: false
51
- requirements:
52
- - - ~>
53
- - !ruby/object:Gem::Version
54
- hash: 31
55
- segments:
56
- - 3
57
- - 12
58
- version: "3.12"
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
59
55
  prerelease: false
60
- requirement: *id003
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
61
63
  name: rdoc
62
- type: :development
63
- - !ruby/object:Gem::Dependency
64
- version_requirements: &id004 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
65
65
  none: false
66
- requirements:
66
+ requirements:
67
67
  - - ~>
68
- - !ruby/object:Gem::Version
69
- hash: 23
70
- segments:
71
- - 1
72
- - 0
73
- - 0
74
- version: 1.0.0
68
+ - !ruby/object:Gem::Version
69
+ version: '3.12'
70
+ type: :development
75
71
  prerelease: false
76
- requirement: *id004
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '3.12'
78
+ - !ruby/object:Gem::Dependency
77
79
  name: bundler
78
- type: :development
79
- - !ruby/object:Gem::Dependency
80
- version_requirements: &id005 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
81
81
  none: false
82
- requirements:
82
+ requirements:
83
83
  - - ~>
84
- - !ruby/object:Gem::Version
85
- hash: 49
86
- segments:
87
- - 1
88
- - 8
89
- - 3
90
- version: 1.8.3
91
- prerelease: false
92
- requirement: *id005
93
- name: jeweler
84
+ - !ruby/object:Gem::Version
85
+ version: 1.1.0
94
86
  type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 1.1.0
95
94
  description: Provides a simple authentication middleware to lock down Rack-based apps
96
- email: kerinin@gmail.com
95
+ email:
96
+ - kerinin@gmail.com
97
97
  executables: []
98
-
99
98
  extensions: []
100
-
101
- extra_rdoc_files:
102
- - LICENSE.txt
103
- - README.md
104
- files:
99
+ extra_rdoc_files: []
100
+ files:
105
101
  - .document
102
+ - .gitignore
106
103
  - Gemfile
107
104
  - Gemfile.lock
108
105
  - LICENSE.txt
@@ -113,38 +110,31 @@ files:
113
110
  - rack-federated-auth.gemspec
114
111
  - test/helper.rb
115
112
  - test/test_rack-federated-auth.rb
116
- homepage: http://github.com/kerinin/rack-federated-auth
117
- licenses:
118
- - MIT
113
+ homepage: http://github.com/otherinbox/rack-federated_auth
114
+ licenses: []
119
115
  post_install_message:
120
116
  rdoc_options: []
121
-
122
- require_paths:
117
+ require_paths:
123
118
  - lib
124
- required_ruby_version: !ruby/object:Gem::Requirement
119
+ required_ruby_version: !ruby/object:Gem::Requirement
125
120
  none: false
126
- requirements:
127
- - - ">="
128
- - !ruby/object:Gem::Version
129
- hash: 3
130
- segments:
131
- - 0
132
- version: "0"
133
- required_rubygems_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ! '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ required_rubygems_version: !ruby/object:Gem::Requirement
134
126
  none: false
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- hash: 3
139
- segments:
140
- - 0
141
- version: "0"
127
+ requirements:
128
+ - - ! '>='
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
142
131
  requirements: []
143
-
144
132
  rubyforge_project:
145
- rubygems_version: 1.8.15
133
+ rubygems_version: 1.8.23
146
134
  signing_key:
147
135
  specification_version: 3
148
- summary: Rack middleware using for federated authentication
149
- test_files: []
150
-
136
+ summary: Omniauth middleware
137
+ test_files:
138
+ - test/helper.rb
139
+ - test/test_rack-federated-auth.rb
140
+ has_rdoc: