devise-heroku 0.0.1

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.
Files changed (53) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +3 -0
  3. data/Rakefile +37 -0
  4. data/app/controllers/devise_heroku/sso_controller.rb +8 -0
  5. data/config/initializers/devise-heroku/heroku_sso.rb +25 -0
  6. data/config/routes.rb +6 -0
  7. data/lib/devise-heroku.rb +18 -0
  8. data/lib/devise-heroku/engine.rb +8 -0
  9. data/lib/devise-heroku/version.rb +3 -0
  10. data/lib/tasks/devise-heroku_tasks.rake +4 -0
  11. data/test/devise-heroku_test.rb +8 -0
  12. data/test/dummy/Rakefile +7 -0
  13. data/test/dummy/app/assets/javascripts/application.js +7 -0
  14. data/test/dummy/app/assets/javascripts/home.js +2 -0
  15. data/test/dummy/app/assets/stylesheets/application.css +7 -0
  16. data/test/dummy/app/assets/stylesheets/home.css +4 -0
  17. data/test/dummy/app/controllers/application_controller.rb +3 -0
  18. data/test/dummy/app/controllers/home_controller.rb +5 -0
  19. data/test/dummy/app/helpers/application_helper.rb +2 -0
  20. data/test/dummy/app/helpers/home_helper.rb +2 -0
  21. data/test/dummy/app/models/user.rb +18 -0
  22. data/test/dummy/app/views/home/index.html.erb +2 -0
  23. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  24. data/test/dummy/config.ru +4 -0
  25. data/test/dummy/config/application.rb +51 -0
  26. data/test/dummy/config/boot.rb +10 -0
  27. data/test/dummy/config/environment.rb +5 -0
  28. data/test/dummy/config/environments/development.rb +30 -0
  29. data/test/dummy/config/environments/production.rb +60 -0
  30. data/test/dummy/config/environments/test.rb +39 -0
  31. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  32. data/test/dummy/config/initializers/devise.rb +213 -0
  33. data/test/dummy/config/initializers/devise_heroku.rb +5 -0
  34. data/test/dummy/config/initializers/inflections.rb +10 -0
  35. data/test/dummy/config/initializers/mime_types.rb +5 -0
  36. data/test/dummy/config/initializers/secret_token.rb +7 -0
  37. data/test/dummy/config/initializers/session_store.rb +8 -0
  38. data/test/dummy/config/initializers/wrap_parameters.rb +10 -0
  39. data/test/dummy/config/locales/devise.en.yml +58 -0
  40. data/test/dummy/config/locales/en.yml +5 -0
  41. data/test/dummy/config/routes.rb +63 -0
  42. data/test/dummy/log/development.log +0 -0
  43. data/test/dummy/log/test.log +3109 -0
  44. data/test/dummy/public/404.html +26 -0
  45. data/test/dummy/public/422.html +26 -0
  46. data/test/dummy/public/500.html +26 -0
  47. data/test/dummy/public/favicon.ico +0 -0
  48. data/test/dummy/script/rails +6 -0
  49. data/test/dummy/test/functional/home_controller_test.rb +9 -0
  50. data/test/dummy/test/unit/helpers/home_helper_test.rb +4 -0
  51. data/test/integration/navigation_test.rb +86 -0
  52. data/test/test_helper.rb +10 -0
  53. metadata +165 -0
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ <p>We've been notified about this issue and we'll take a look at it shortly.</p>
24
+ </div>
25
+ </body>
26
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,9 @@
1
+ require 'test_helper'
2
+
3
+ class HomeControllerTest < ActionController::TestCase
4
+ test "should get index" do
5
+ get :index
6
+ assert_response :success
7
+ end
8
+
9
+ end
@@ -0,0 +1,4 @@
1
+ require 'test_helper'
2
+
3
+ class HomeHelperTest < ActionView::TestCase
4
+ end
@@ -0,0 +1,86 @@
1
+ require 'test_helper'
2
+
3
+ class NavigationTest < ActionDispatch::IntegrationTest
4
+
5
+ setup :set_salt
6
+
7
+ test "fail if missing params" do
8
+ id, timestamp, token = valid_token
9
+
10
+ post "/heroku/sso/login", :token => token
11
+ assert_equal 302, status
12
+ assert_equal "/unauthenticated", path
13
+
14
+ post "/heroku/sso/login", :id => id
15
+ assert_equal 302, status
16
+ assert_equal "/unauthenticated", path
17
+
18
+ post "/heroku/sso/login", :timestamp => timestamp
19
+ assert_equal 302, status
20
+ assert_equal "/unauthenticated", path
21
+
22
+ post "/heroku/sso/login", :id => id, :timestamp => timestamp
23
+ assert_equal 302, status
24
+ assert_equal "/unauthenticated", path
25
+
26
+ post "/heroku/sso/login", :token => token, :timestamp => timestamp
27
+ assert_equal 302, status
28
+ assert_equal "/unauthenticated", path
29
+
30
+ post "/heroku/sso/login", :token => token, :id => id
31
+ assert_equal 302, status
32
+ assert_equal "/unauthenticated", path
33
+ end
34
+
35
+ test "fail if bad token" do
36
+ id, timestamp, token = valid_token
37
+
38
+ post "/heroku/sso/login", :id => id, :timestamp => timestamp, :token => "someOtherToken"
39
+ assert_equal 302, status
40
+ assert_equal "/heroku/sso/login", path
41
+ end
42
+
43
+ test "fail if old token" do
44
+ id, timestamp, token = old_token
45
+
46
+ post "/heroku/sso/login", :id => id, :timestamp => timestamp, :token => token
47
+ assert_equal 302, status
48
+ assert_equal "/heroku/sso/login", path
49
+ end
50
+
51
+ test "fail if old not found" do
52
+ id, timestamp, token = valid_token(2)
53
+ post "/heroku/sso/login", :id => id, :timestamp => timestamp, :token => token
54
+ assert_equal 302, status
55
+ assert_equal "/unauthenticated", path
56
+ end
57
+
58
+ test "succeeds with valid token" do
59
+ id, timestamp, token = valid_token(1)
60
+ post "/heroku/sso/login", :id => id, :timestamp => timestamp, :token => token
61
+
62
+ assert_equal 302, status
63
+ assert_equal "/heroku/sso/login", path
64
+ assert_redirected_to "/"
65
+ end
66
+
67
+ private
68
+ def set_salt
69
+ # must match value in dummy app initializer
70
+ @sso_salt = "happy day!"
71
+ end
72
+
73
+ def valid_token(id = 1)
74
+ timestamp = Time.now.getutc
75
+ pre_token = "#{id}:#{@sso_salt}:#{@timestamp}"
76
+ [id, timestamp, Digest::SHA1.hexdigest(pre_token).to_s]
77
+ end
78
+
79
+ def old_token(id = 1)
80
+ time = Time.at(0)
81
+ timestamp = time.getutc
82
+ pre_token = "#{id}:#{@sso_salt}:#{@timestamp}"
83
+ [id, timestamp, Digest::SHA1.hexdigest(pre_token).to_s]
84
+ end
85
+ end
86
+
@@ -0,0 +1,10 @@
1
+ # Configure Rails Environment
2
+ ENV["RAILS_ENV"] = "test"
3
+
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+ require "rails/test_help"
6
+
7
+ Rails.backtrace_cleaner.remove_silencers!
8
+
9
+ # Load support files
10
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
metadata ADDED
@@ -0,0 +1,165 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: devise-heroku
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Adam Schepis
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2012-04-30 00:00:00 -04:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rails
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: 3.1.1
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: *id001
27
+ description: Heroku SSO Strategy for Devise
28
+ email:
29
+ - adam.schepis@gmail.com
30
+ executables: []
31
+
32
+ extensions: []
33
+
34
+ extra_rdoc_files: []
35
+
36
+ files:
37
+ - app/controllers/devise_heroku/sso_controller.rb
38
+ - config/initializers/devise-heroku/heroku_sso.rb
39
+ - config/routes.rb
40
+ - lib/devise-heroku/engine.rb
41
+ - lib/devise-heroku/version.rb
42
+ - lib/devise-heroku.rb
43
+ - lib/tasks/devise-heroku_tasks.rake
44
+ - MIT-LICENSE
45
+ - Rakefile
46
+ - README.rdoc
47
+ - test/devise-heroku_test.rb
48
+ - test/dummy/app/assets/javascripts/application.js
49
+ - test/dummy/app/assets/javascripts/home.js
50
+ - test/dummy/app/assets/stylesheets/application.css
51
+ - test/dummy/app/assets/stylesheets/home.css
52
+ - test/dummy/app/controllers/application_controller.rb
53
+ - test/dummy/app/controllers/home_controller.rb
54
+ - test/dummy/app/helpers/application_helper.rb
55
+ - test/dummy/app/helpers/home_helper.rb
56
+ - test/dummy/app/models/user.rb
57
+ - test/dummy/app/views/home/index.html.erb
58
+ - test/dummy/app/views/layouts/application.html.erb
59
+ - test/dummy/config/application.rb
60
+ - test/dummy/config/boot.rb
61
+ - test/dummy/config/environment.rb
62
+ - test/dummy/config/environments/development.rb
63
+ - test/dummy/config/environments/production.rb
64
+ - test/dummy/config/environments/test.rb
65
+ - test/dummy/config/initializers/backtrace_silencers.rb
66
+ - test/dummy/config/initializers/devise.rb
67
+ - test/dummy/config/initializers/devise_heroku.rb
68
+ - test/dummy/config/initializers/inflections.rb
69
+ - test/dummy/config/initializers/mime_types.rb
70
+ - test/dummy/config/initializers/secret_token.rb
71
+ - test/dummy/config/initializers/session_store.rb
72
+ - test/dummy/config/initializers/wrap_parameters.rb
73
+ - test/dummy/config/locales/devise.en.yml
74
+ - test/dummy/config/locales/en.yml
75
+ - test/dummy/config/routes.rb
76
+ - test/dummy/config.ru
77
+ - test/dummy/log/development.log
78
+ - test/dummy/log/test.log
79
+ - test/dummy/public/404.html
80
+ - test/dummy/public/422.html
81
+ - test/dummy/public/500.html
82
+ - test/dummy/public/favicon.ico
83
+ - test/dummy/Rakefile
84
+ - test/dummy/script/rails
85
+ - test/dummy/test/functional/home_controller_test.rb
86
+ - test/dummy/test/unit/helpers/home_helper_test.rb
87
+ - test/integration/navigation_test.rb
88
+ - test/test_helper.rb
89
+ has_rdoc: true
90
+ homepage: https://github.com/aschepis/devise-heroku
91
+ licenses: []
92
+
93
+ post_install_message:
94
+ rdoc_options: []
95
+
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ hash: -2838781733466123267
104
+ segments:
105
+ - 0
106
+ version: "0"
107
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
+ none: false
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ hash: -2838781733466123267
113
+ segments:
114
+ - 0
115
+ version: "0"
116
+ requirements: []
117
+
118
+ rubyforge_project:
119
+ rubygems_version: 1.6.2
120
+ signing_key:
121
+ specification_version: 3
122
+ summary: Heroku SSO Strategy for Devise
123
+ test_files:
124
+ - test/devise-heroku_test.rb
125
+ - test/dummy/app/assets/javascripts/application.js
126
+ - test/dummy/app/assets/javascripts/home.js
127
+ - test/dummy/app/assets/stylesheets/application.css
128
+ - test/dummy/app/assets/stylesheets/home.css
129
+ - test/dummy/app/controllers/application_controller.rb
130
+ - test/dummy/app/controllers/home_controller.rb
131
+ - test/dummy/app/helpers/application_helper.rb
132
+ - test/dummy/app/helpers/home_helper.rb
133
+ - test/dummy/app/models/user.rb
134
+ - test/dummy/app/views/home/index.html.erb
135
+ - test/dummy/app/views/layouts/application.html.erb
136
+ - test/dummy/config/application.rb
137
+ - test/dummy/config/boot.rb
138
+ - test/dummy/config/environment.rb
139
+ - test/dummy/config/environments/development.rb
140
+ - test/dummy/config/environments/production.rb
141
+ - test/dummy/config/environments/test.rb
142
+ - test/dummy/config/initializers/backtrace_silencers.rb
143
+ - test/dummy/config/initializers/devise.rb
144
+ - test/dummy/config/initializers/devise_heroku.rb
145
+ - test/dummy/config/initializers/inflections.rb
146
+ - test/dummy/config/initializers/mime_types.rb
147
+ - test/dummy/config/initializers/secret_token.rb
148
+ - test/dummy/config/initializers/session_store.rb
149
+ - test/dummy/config/initializers/wrap_parameters.rb
150
+ - test/dummy/config/locales/devise.en.yml
151
+ - test/dummy/config/locales/en.yml
152
+ - test/dummy/config/routes.rb
153
+ - test/dummy/config.ru
154
+ - test/dummy/log/development.log
155
+ - test/dummy/log/test.log
156
+ - test/dummy/public/404.html
157
+ - test/dummy/public/422.html
158
+ - test/dummy/public/500.html
159
+ - test/dummy/public/favicon.ico
160
+ - test/dummy/Rakefile
161
+ - test/dummy/script/rails
162
+ - test/dummy/test/functional/home_controller_test.rb
163
+ - test/dummy/test/unit/helpers/home_helper_test.rb
164
+ - test/integration/navigation_test.rb
165
+ - test/test_helper.rb