nyauth 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -0
  3. data/app/controllers/concerns/nyauth/session_concern.rb +8 -12
  4. data/lib/nyauth/engine.rb +4 -0
  5. data/lib/nyauth/middleware.rb +17 -0
  6. data/lib/nyauth/nyan.rb +31 -0
  7. data/lib/nyauth/session_serializer.rb +46 -0
  8. data/lib/nyauth/test/controller_macros.rb +15 -0
  9. data/lib/nyauth/test/feature_macros.rb +19 -0
  10. data/lib/nyauth/version.rb +1 -1
  11. data/lib/nyauth.rb +1 -0
  12. data/spec/dummy/config/environments/test.rb +0 -2
  13. data/spec/dummy/db/test.sqlite3 +0 -0
  14. data/spec/dummy/log/development.log +274 -0
  15. data/spec/dummy/log/test.log +11026 -0
  16. data/spec/dummy/tmp/capybara/capybara-201507140024395867592984.html +14 -0
  17. data/spec/dummy/tmp/capybara/capybara-201507140036006205629508.html +15 -0
  18. data/spec/featrues/nyauth/sessions_spec.rb +8 -0
  19. data/spec/rails_helper.rb +4 -3
  20. data/spec/support/controllers/nyauth/session_concern.rb +1 -1
  21. metadata +11 -58
  22. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/00R4IbuMWUgW0TswtkCnDqB8MUJqvz76FgkmbrLPTd8.cache +0 -0
  23. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/1-v7tFLPkD6uyCpAKjAKORwPg5YalyY-SYwjNGTiHQo.cache +0 -1
  24. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/122B1KZyQmgyJoX7uc4JINcUDUmcMHJsbf5JopBIpSg.cache +0 -2
  25. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/2W23wCoDaNvkpc-htXrPJ_4wwRXsCB8sDUi-vlecXRY.cache +0 -1
  26. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/8UAh9fJot2eROIl2PFflmIp2Q0G3oNNzBxCYx6AWaTw.cache +0 -3
  27. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/8Ze9kDXrEQxOBazUvSE0NM5zLGZnHFsDskzK_P47vk4.cache +0 -1
  28. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Ald0qisxC6krU6CCGUtsVQJwZ786HWf2a4VJnhi2Lrw.cache +0 -1
  29. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Bx8MbffT9WQGgl0DcTM5n11UlQabeTzIyqKGm2snGus.cache +0 -1
  30. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/CjFGeOmtoOvDUwEi78Mx3PtuchpMqlfecazo-n8RsAQ.cache +0 -0
  31. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/DK6c5xJ8kSeXSqJlndPmMohu6AMbxDTYw3amSuVkoTs.cache +0 -2
  32. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/E16A8LE9OYp6k-WBc2Egdmn6XL_-ipcmDOYBOfBITqs.cache +0 -2
  33. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/EGILbSm92CBXW0Z6Mp6o2YygxS4b8Hhd2CW8igzKuRM.cache +0 -1
  34. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/FIPwj786RByADaWtmUkp2eeWQvQ_QmX1ER1sGGOKgqo.cache +0 -1
  35. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Fo9EHolUACmT7eKdJVmIzktbVgFRBZQkcCGHFfpD7u0.cache +0 -1
  36. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/KiPxsMrAEr8OMX4H_Q8MSOgJ0PuFTQf2yX0S4kZsDVs.cache +0 -1
  37. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Tpj_x0CkqGAEMDgH-JGBkdkajznkLbbiVVZOxEqURxU.cache +0 -0
  38. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/ZM48tpiRiDxrKqKUvohWJfOeqwp5RsXgtKY84fW-qEE.cache +0 -0
  39. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/ZcwAlVnn77peLsFoZbCh7F7wpmxPhsehRs1frol6gfU.cache +0 -1
  40. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/h1z_izpQoHamMnv_RoNWN6gT2x3tY11ndWa7uVWkiaE.cache +0 -0
  41. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/k-V4Qz1zxawVTQoo00igdXRPgv4xOiV8fQsQtj8uDhA.cache +0 -0
  42. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/lANr4VX8LDWQ3kMj0yoqyqiwK3SEqtIXkA-22639ZQQ.cache +0 -2
  43. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/mKfHoait9-j98PxObraQnsOWSk7xeFfrgppKbFtsUP0.cache +0 -1
  44. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/s0L4Qc1LxOsV_VIoN33m851q4i5lQVM1ygIhke4UJhM.cache +0 -2
  45. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/sjZSTu90VegaTEOBnEbgI9A0_THfWp-_QVzTR7p7m_k.cache +0 -1
  46. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/y7TMQhIN-uRk0HFOYLmEtgTZdktzieFoy6OGzULuesI.cache +0 -0
  47. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/ysMIP1GiNEslwSMFx4V6kVDb4UFG1mgq0U7Pjh2AIzY.cache +0 -1
  48. data/spec/support/macros/controller_macros.rb +0 -3
  49. data/spec/support/macros/feature_macros.rb +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ad3b4a881cc5ba9efe2e7230467642068906b52
4
- data.tar.gz: 50d8fdee969e3210e9a54217bcc0b146bec4fb1a
3
+ metadata.gz: 861266924d983e8acf72255c94ad4d72b0683091
4
+ data.tar.gz: 5bb980ac94bde104fd846d20f97baa04f86dd20a
5
5
  SHA512:
6
- metadata.gz: da27181102d3320122ca94bcc6b9f8bd1864675b8d49f0e697a93fd01a4d53dc1f37878441ba96bdb4149e4bb81e7702664726d998929600f91a9e0ac386625f
7
- data.tar.gz: 3dd04d685f016d32c57ce1d80b6ac9e5058f6e178be9227c03a8ba085928c8a5f54367d476f0fbaad3d70e24bc13ca96fc7a5558a2b7eb7d3749ef52789624a0
6
+ metadata.gz: 2fb342c65b829ee4a75bb2369adac0ab16b46b17ffa85f5d35145ee736940da6cd1b3acb31e7339a665cf544534f7ba56ef4a2173a30e9b37d31586b4fe0e274
7
+ data.tar.gz: a8da371ffd5781f80c173737ffa7fe9a25fbfa5184d8895b3d62dfffe4a9efc2296fa68b87051ee484a673bb5fcec8c5b4deeed19b47c4127af4e3590ecb4264
data/README.md CHANGED
@@ -9,6 +9,8 @@ Simple & modualbe authentication gem
9
9
  ```ruby
10
10
  class ApplicationController < ActionController::Base
11
11
  include Nyauth::SessionConcern
12
+ include Nyauth::ClientConcern
13
+ before_action -> { require_authentication! as: client_name }
12
14
  end
13
15
  ```
14
16
 
@@ -20,7 +20,8 @@ module Nyauth
20
20
  # signed_in?(as: :user)
21
21
  def signed_in?(options = {})
22
22
  options.reverse_merge!(as: :user)
23
- current_authenticated.present? && current_authenticated.class.name.demodulize.underscore == options[:as].to_s
23
+ current_authenticated(options).present? && \
24
+ current_authenticated(options).class.name.demodulize.underscore == options[:as].to_s
24
25
  end
25
26
 
26
27
  # ex.)
@@ -38,24 +39,19 @@ module Nyauth
38
39
  head :unauthorized unless signed_in?(options)
39
40
  end
40
41
 
41
- def current_authenticated
42
- return nil unless session_value = session[signed_in_session_key]
43
- klass_name, client_id = Nyauth::Encryptor.decrypt(session_value).split(':')
44
- klass_name.constantize.find(client_id)
42
+ def current_authenticated(options = {})
43
+ options.reverse_merge!(as: :user)
44
+ nyauth_nyan.session.fetch(options[:as])
45
45
  end
46
46
 
47
47
  def store_signed_in_session(client)
48
- session[signed_in_session_key] = signed_in_session_object(client)
48
+ nyauth_nyan.session.store(client, client.class.name.demodulize.underscore)
49
49
  end
50
50
 
51
51
  private
52
52
 
53
- def signed_in_session_key
54
- "sign_in_session"
55
- end
56
-
57
- def signed_in_session_object(client)
58
- Nyauth::Encryptor.encrypt("#{client.class.name}:#{client.id}")
53
+ def nyauth_nyan
54
+ request.env['nyauth']
59
55
  end
60
56
 
61
57
  module ClassMethods
data/lib/nyauth/engine.rb CHANGED
@@ -17,5 +17,9 @@ module Nyauth
17
17
  g.assets false
18
18
  g.helper false
19
19
  end
20
+
21
+ initializer 'nyauth.add_middleware' do |app|
22
+ app.middleware.use Nyauth::Middleware
23
+ end
20
24
  end
21
25
  end
@@ -0,0 +1,17 @@
1
+ require 'nyauth/nyan'
2
+
3
+ module Nyauth
4
+ class Middleware
5
+ def initialize(app)
6
+ @app = app
7
+ end
8
+
9
+ def call(env)
10
+ return @app.call(env) if env['nyauth']
11
+ env['nyauth'] = Nyauth::Nyan.new(env)
12
+ Nyauth::Nyan.run_callback env['nyauth'] do
13
+ @app.call(env)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,31 @@
1
+ require 'nyauth/session_serializer'
2
+
3
+ module Nyauth
4
+ class Nyan
5
+ def initialize(env)
6
+ @env = env
7
+ end
8
+
9
+ def session
10
+ @serializer ||= Nyauth::SessionSerializer.new(@env)
11
+ end
12
+
13
+ def self.run_callback(nyan, &block)
14
+ %w(on_test_request).each do |kind|
15
+ __send__("_#{kind}").each do |callback, options|
16
+ callback.call(nyan, *options)
17
+ end
18
+ end
19
+ @@_on_test_request = []
20
+ yield
21
+ end
22
+
23
+ def self.on_test_request(options = {}, &block)
24
+ _on_test_request.push([block, options])
25
+ end
26
+
27
+ def self._on_test_request
28
+ @@_on_test_request ||= []
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,46 @@
1
+ module Nyauth
2
+ class SessionSerializer
3
+ def initialize(env)
4
+ @env = env
5
+ end
6
+
7
+ def key_for(scope)
8
+ "nyauth.#{scope}.session"
9
+ end
10
+
11
+ def serialize(client)
12
+ Nyauth::Encryptor.encrypt("#{client.class.name}:#{client.id}")
13
+ end
14
+
15
+ def deserialize(key)
16
+ klass_name, client_id = Nyauth::Encryptor.decrypt(key).split(':')
17
+ klass_name.constantize.find_by(id: client_id)
18
+ end
19
+
20
+ def store(client, scope)
21
+ return unless client
22
+ session[key_for(scope)] = serialize(client)
23
+ end
24
+
25
+ def fetch(scope)
26
+ key = session[key_for(scope)]
27
+ return nil unless key
28
+
29
+ client = deserialize(key)
30
+ delete(scope) unless client
31
+ client
32
+ end
33
+
34
+ def stored?(scope)
35
+ !!session[key_for(scope)]
36
+ end
37
+
38
+ def delete(scope, client=nil)
39
+ session.delete(key_for(scope))
40
+ end
41
+
42
+ def session
43
+ @env['rack.session'] || {}
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,15 @@
1
+ module Nyauth
2
+ module Test
3
+ module ControllerMacros
4
+ include Nyauth::SessionConcern
5
+
6
+ def self.included(base)
7
+ base.instance_eval do
8
+ before do
9
+ @request.env['nyauth'] = Nyauth::Nyan.new(@request.env)
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,19 @@
1
+ module Nyauth
2
+ module Test
3
+ module FeatureMacros
4
+ include Nyauth::SessionConcern
5
+
6
+ def sign_in(client)
7
+ Nyauth::Nyan.on_test_request do |nyauth_nyan|
8
+ nyauth_nyan.session.store(client, client.class.name.demodulize.underscore)
9
+ end
10
+ end
11
+
12
+ def sign_out
13
+ Nyauth::Nyan.on_test_request do |nyauth_nyan|
14
+ nyauth_nyan.session.session.clear
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,3 +1,3 @@
1
1
  module Nyauth
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
data/lib/nyauth.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'nyauth/middleware'
1
2
  require 'nyauth/engine'
2
3
  require 'nyauth/encryptor'
3
4
  require 'nyauth/configuration'
@@ -40,7 +40,5 @@ Rails.application.configure do
40
40
  # Raises error for missing translations
41
41
  # config.action_view.raise_on_missing_translations = true
42
42
 
43
- config.middleware.use RackSessionAccess::Middleware
44
-
45
43
  config.action_mailer.default_url_options = { host: 'www.example.com' }
46
44
  end
Binary file
@@ -10048,3 +10048,277 @@ Started GET "/session/new" for 127.0.0.1 at 2015-07-11 22:53:24 +0900
10048
10048
  Processing by Nyauth::SessionsController#new as HTML
10049
10049
  Rendered /Users/koshikawa/repository/github.com/ppworks/nyauth/app/views/nyauth/sessions/new.html.erb within layouts/application (7.8ms)
10050
10050
  Completed 200 OK in 32ms (Views: 31.1ms | ActiveRecord: 0.0ms)
10051
+
10052
+
10053
+ Started GET "/" for 127.0.0.1 at 2015-07-14 00:25:22 +0900
10054
+ ActiveRecord::SchemaMigration Load (0.5ms) SELECT "schema_migrations".* FROM "schema_migrations"
10055
+ Processing by PagesController#index as HTML
10056
+ Rendered pages/index.html.erb within layouts/application (1.9ms)
10057
+ Completed 200 OK in 400ms (Views: 399.6ms | ActiveRecord: 0.0ms)
10058
+
10059
+
10060
+ Started GET "/" for 127.0.0.1 at 2015-07-14 00:25:22 +0900
10061
+ Processing by PagesController#index as HTML
10062
+ Rendered pages/index.html.erb within layouts/application (0.0ms)
10063
+ Completed 200 OK in 13ms (Views: 13.3ms | ActiveRecord: 0.0ms)
10064
+
10065
+
10066
+ Started GET "/session/new" for 127.0.0.1 at 2015-07-14 00:25:29 +0900
10067
+ Processing by Nyauth::SessionsController#new as HTML
10068
+ Rendered /Users/koshikawa/repository/github.com/ppworks/nyauth/app/views/nyauth/sessions/new.html.erb within layouts/application (22.5ms)
10069
+ Completed 200 OK in 53ms (Views: 43.8ms | ActiveRecord: 0.0ms)
10070
+
10071
+
10072
+ Started POST "/session" for 127.0.0.1 at 2015-07-14 00:25:31 +0900
10073
+ Processing by Nyauth::SessionsController#create as HTML
10074
+ Parameters: {"utf8"=>"✓", "authenticity_token"=>"dsbNx6a93ObdIKgZK+TwTJOJ0vBuplMB90Ws25rEyF2mP8QF9iqkF7/b/khPven8fDr/Sb4cFqX37kNPKw85Bg==", "session_service"=>{"email"=>"ppworks@example.com", "password"=>"[FILTERED]"}, "commit"=>"Sign in"}
10075
+ User Load (1.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? ORDER BY "users"."id" DESC LIMIT 1 [["email", "ppworks@example.com"]]
10076
+ Redirected to http://www.lvh.me:3000/
10077
+ Completed 302 Found in 332ms (ActiveRecord: 1.4ms)
10078
+
10079
+
10080
+ Started GET "/" for 127.0.0.1 at 2015-07-14 00:25:31 +0900
10081
+ Processing by PagesController#index as HTML
10082
+ Rendered pages/index.html.erb within layouts/application (0.0ms)
10083
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
10084
+ CACHE (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", "1"]]
10085
+ CACHE (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", "1"]]
10086
+ CACHE (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", "1"]]
10087
+ Completed 200 OK in 24ms (Views: 23.7ms | ActiveRecord: 0.2ms)
10088
+
10089
+
10090
+ Started DELETE "/session" for 127.0.0.1 at 2015-07-14 00:25:32 +0900
10091
+ Processing by Nyauth::SessionsController#destroy as HTML
10092
+ Parameters: {"authenticity_token"=>"3PzMfD8BnMgfMmgielRdJOuAmUOCmZ6DZwRNzo8pHI8MBcW+b5bkOX3JPnMeDUSUBDO0+lIj2ydnr6JaPuLt1A=="}
10093
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
10094
+ CACHE (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", "1"]]
10095
+ Redirected to http://www.lvh.me:3000/session/new
10096
+ Completed 302 Found in 24ms (ActiveRecord: 0.2ms)
10097
+
10098
+
10099
+ Started GET "/session/new" for 127.0.0.1 at 2015-07-14 00:25:32 +0900
10100
+ Processing by Nyauth::SessionsController#new as HTML
10101
+ Rendered /Users/koshikawa/repository/github.com/ppworks/nyauth/app/views/nyauth/sessions/new.html.erb within layouts/application (7.1ms)
10102
+ Completed 200 OK in 36ms (Views: 34.3ms | ActiveRecord: 0.0ms)
10103
+
10104
+
10105
+ Started GET "/admin/session/new" for 127.0.0.1 at 2015-07-14 00:25:35 +0900
10106
+ Processing by Nyauth::SessionsController#new as HTML
10107
+ Rendered /Users/koshikawa/repository/github.com/ppworks/nyauth/app/views/nyauth/sessions/new.html.erb within layouts/application (15.5ms)
10108
+ Completed 200 OK in 48ms (Views: 45.1ms | ActiveRecord: 0.0ms)
10109
+
10110
+
10111
+ Started POST "/admin/session" for 127.0.0.1 at 2015-07-14 00:25:37 +0900
10112
+ Processing by Nyauth::SessionsController#create as HTML
10113
+ Parameters: {"utf8"=>"✓", "authenticity_token"=>"9cY1W3k0b+G+wop/7ztfNXrp2FLPWvIoyTPst3B7L0wLLKpwKTulibzzBH7StacJeJpcj2ilVvktaULwNEXpVg==", "session_service"=>{"email"=>"admin@example.com", "password"=>"[FILTERED]"}, "commit"=>"Sign in"}
10114
+ Admin Load (1.4ms) SELECT "admins".* FROM "admins" WHERE "admins"."email" = ? ORDER BY "admins"."id" DESC LIMIT 1 [["email", "admin@example.com"]]
10115
+ Redirected to http://www.lvh.me:3000/
10116
+ Completed 302 Found in 27ms (ActiveRecord: 1.7ms)
10117
+
10118
+
10119
+ Started GET "/" for 127.0.0.1 at 2015-07-14 00:25:37 +0900
10120
+ Processing by PagesController#index as HTML
10121
+ Rendered pages/index.html.erb within layouts/application (0.0ms)
10122
+ Completed 200 OK in 21ms (Views: 21.2ms | ActiveRecord: 0.0ms)
10123
+
10124
+
10125
+ Started GET "/" for 127.0.0.1 at 2015-07-14 00:25:40 +0900
10126
+ Processing by PagesController#index as HTML
10127
+ Rendered pages/index.html.erb within layouts/application (0.0ms)
10128
+ Completed 200 OK in 13ms (Views: 13.0ms | ActiveRecord: 0.0ms)
10129
+
10130
+
10131
+ Started GET "/assets/application.self-e80e8f2318043e8af94dddc2adad5a4f09739a8ebb323b3ab31cd71d45fd9113.css?body=1" for 127.0.0.1 at 2015-07-14 00:25:40 +0900
10132
+
10133
+
10134
+ Started GET "/assets/jquery_ujs.self-ca5248a2fad13d6bd58ea121318d642f195f0b2dd818b30615f785ff365e8d1f.js?body=1" for 127.0.0.1 at 2015-07-14 00:25:40 +0900
10135
+
10136
+
10137
+ Started GET "/assets/jquery.self-d03a5518f45df77341bdbe6201ba3bfa547ebba8ed64f0ea56bfa5f96ea7c074.js?body=1" for 127.0.0.1 at 2015-07-14 00:25:40 +0900
10138
+
10139
+
10140
+ Started GET "/assets/application.self-2b00c68320848afe54cf9919a7a76ed257f93bdb6e12dc2160d07a8b1fe5e9f4.js?body=1" for 127.0.0.1 at 2015-07-14 00:25:40 +0900
10141
+
10142
+
10143
+ Started GET "/admin/session/new" for 127.0.0.1 at 2015-07-14 00:26:18 +0900
10144
+ Processing by Nyauth::SessionsController#new as HTML
10145
+ Rendered /Users/koshikawa/repository/github.com/ppworks/nyauth/app/views/nyauth/sessions/new.html.erb within layouts/application (5.0ms)
10146
+ Completed 500 Internal Server Error in 3724ms
10147
+
10148
+ ActionView::Template::Error (undefined method `-@' for nil:NilClass):
10149
+ 19: <% if signed_in?(as: :user) %>
10150
+ 20: <%= link_to 'Sign out', session_path_for(:user), class: 'pure-menu-link', method: :delete %>
10151
+ 21: <% end %>
10152
+ 22: <% - binding.pry %>
10153
+ 23: <% if signed_in?(as: :admin) %>
10154
+ 24: <%= link_to 'Sign out', session_path_for(:admin), class: 'pure-menu-link', method: :delete %>
10155
+ 25: <% end %>
10156
+ app/views/layouts/application.html.erb:22:in `_app_views_layouts_application_html_erb__4346455556384825248_70271700157580'
10157
+
10158
+
10159
+ Rendered /Users/koshikawa/repository/github.com/ppworks/nyauth/vendor/bundle/gems/actionpack-4.2.0/lib/action_dispatch/middleware/templates/rescues/_source.erb (4.7ms)
10160
+ Rendered /Users/koshikawa/repository/github.com/ppworks/nyauth/vendor/bundle/gems/actionpack-4.2.0/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (2.2ms)
10161
+ Rendered /Users/koshikawa/repository/github.com/ppworks/nyauth/vendor/bundle/gems/actionpack-4.2.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (0.9ms)
10162
+ Rendered /Users/koshikawa/repository/github.com/ppworks/nyauth/vendor/bundle/gems/actionpack-4.2.0/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout (45.8ms)
10163
+
10164
+
10165
+ Started GET "/admin/session/new" for 127.0.0.1 at 2015-07-14 00:26:22 +0900
10166
+ Processing by Nyauth::SessionsController#new as HTML
10167
+ Rendered /Users/koshikawa/repository/github.com/ppworks/nyauth/app/views/nyauth/sessions/new.html.erb within layouts/application (8.2ms)
10168
+ Completed 500 Internal Server Error in 4570ms
10169
+
10170
+ ActionView::Template::Error (undefined method `-@' for nil:NilClass):
10171
+ 19: <% if signed_in?(as: :user) %>
10172
+ 20: <%= link_to 'Sign out', session_path_for(:user), class: 'pure-menu-link', method: :delete %>
10173
+ 21: <% end %>
10174
+ 22: <% - binding.pry %>
10175
+ 23: <% if signed_in?(as: :admin) %>
10176
+ 24: <%= link_to 'Sign out', session_path_for(:admin), class: 'pure-menu-link', method: :delete %>
10177
+ 25: <% end %>
10178
+ app/views/layouts/application.html.erb:22:in `_app_views_layouts_application_html_erb__4346455556384825248_70271700157580'
10179
+
10180
+
10181
+ Rendered /Users/koshikawa/repository/github.com/ppworks/nyauth/vendor/bundle/gems/actionpack-4.2.0/lib/action_dispatch/middleware/templates/rescues/_source.erb (4.6ms)
10182
+ Rendered /Users/koshikawa/repository/github.com/ppworks/nyauth/vendor/bundle/gems/actionpack-4.2.0/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (2.0ms)
10183
+ Rendered /Users/koshikawa/repository/github.com/ppworks/nyauth/vendor/bundle/gems/actionpack-4.2.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (0.7ms)
10184
+ Rendered /Users/koshikawa/repository/github.com/ppworks/nyauth/vendor/bundle/gems/actionpack-4.2.0/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout (41.8ms)
10185
+
10186
+
10187
+ Started GET "/admin/session/new" for 127.0.0.1 at 2015-07-14 00:26:38 +0900
10188
+ Processing by Nyauth::SessionsController#new as HTML
10189
+ Rendered /Users/koshikawa/repository/github.com/ppworks/nyauth/app/views/nyauth/sessions/new.html.erb within layouts/application (7.5ms)
10190
+ Completed 200 OK in 3673ms (Views: 3672.4ms | ActiveRecord: 0.0ms)
10191
+
10192
+
10193
+ Started GET "/assets/jquery.self-d03a5518f45df77341bdbe6201ba3bfa547ebba8ed64f0ea56bfa5f96ea7c074.js?body=1" for 127.0.0.1 at 2015-07-14 00:26:41 +0900
10194
+
10195
+
10196
+ Started GET "/assets/application.self-e80e8f2318043e8af94dddc2adad5a4f09739a8ebb323b3ab31cd71d45fd9113.css?body=1" for 127.0.0.1 at 2015-07-14 00:26:41 +0900
10197
+
10198
+
10199
+ Started GET "/assets/jquery_ujs.self-ca5248a2fad13d6bd58ea121318d642f195f0b2dd818b30615f785ff365e8d1f.js?body=1" for 127.0.0.1 at 2015-07-14 00:26:41 +0900
10200
+
10201
+
10202
+ Started GET "/assets/application.self-2b00c68320848afe54cf9919a7a76ed257f93bdb6e12dc2160d07a8b1fe5e9f4.js?body=1" for 127.0.0.1 at 2015-07-14 00:26:41 +0900
10203
+
10204
+
10205
+ Started POST "/admin/session" for 127.0.0.1 at 2015-07-14 00:26:45 +0900
10206
+ Processing by Nyauth::SessionsController#create as HTML
10207
+ Parameters: {"utf8"=>"✓", "authenticity_token"=>"YkHLGXy/LzeKVXCBEKQ6/Xd4vv6M3XjDTDkv82n8irmcq1QyLLDlX4hk/oAtKsLBdQs6Iysi3BKoY4G0LcJMow==", "session_service"=>{"email"=>"admin@example.com", "password"=>"[FILTERED]"}, "commit"=>"Sign in"}
10208
+ Admin Load (0.6ms) SELECT "admins".* FROM "admins" WHERE "admins"."email" = ? ORDER BY "admins"."id" DESC LIMIT 1 [["email", "admin@example.com"]]
10209
+ Redirected to http://www.lvh.me:3000/
10210
+ Completed 302 Found in 19ms (ActiveRecord: 0.6ms)
10211
+
10212
+
10213
+ Started GET "/" for 127.0.0.1 at 2015-07-14 00:26:45 +0900
10214
+ Processing by PagesController#index as HTML
10215
+ Rendered pages/index.html.erb within layouts/application (0.1ms)
10216
+ Admin Load (0.2ms) SELECT "admins".* FROM "admins" WHERE "admins"."id" = ? LIMIT 1 [["id", 1]]
10217
+ Completed 200 OK in 101498ms (Views: 101496.0ms | ActiveRecord: 0.2ms)
10218
+
10219
+
10220
+ Started GET "/" for 127.0.0.1 at 2015-07-14 00:28:30 +0900
10221
+ Processing by PagesController#index as HTML
10222
+ Rendered pages/index.html.erb within layouts/application (0.1ms)
10223
+ Completed 200 OK in 98135ms (Views: 98132.9ms | ActiveRecord: 0.0ms)
10224
+
10225
+
10226
+ Started GET "/admin/session/new" for 127.0.0.1 at 2015-07-14 00:30:08 +0900
10227
+ Processing by Nyauth::SessionsController#new as HTML
10228
+ Rendered /Users/koshikawa/repository/github.com/ppworks/nyauth/app/views/nyauth/sessions/new.html.erb within layouts/application (10.6ms)
10229
+ Completed 200 OK in 4707ms (Views: 4701.0ms | ActiveRecord: 0.0ms)
10230
+
10231
+
10232
+ Started GET "/admin/session/new" for 127.0.0.1 at 2015-07-14 00:30:13 +0900
10233
+ Processing by Nyauth::SessionsController#new as HTML
10234
+ Rendered /Users/koshikawa/repository/github.com/ppworks/nyauth/app/views/nyauth/sessions/new.html.erb within layouts/application (4.4ms)
10235
+ Completed 200 OK in 4260ms (Views: 4259.4ms | ActiveRecord: 0.0ms)
10236
+
10237
+
10238
+ Started POST "/admin/session" for 127.0.0.1 at 2015-07-14 00:30:20 +0900
10239
+ Processing by Nyauth::SessionsController#create as HTML
10240
+ Parameters: {"utf8"=>"✓", "authenticity_token"=>"AFjbrUjCsxEFC6+JCoY3BXC7ZTBAbmtuRfRo+IBeM8T+skSGGM15eQc6IYg3CM85csjh7eeRz7+hrsa/xGD13g==", "session_service"=>{"email"=>"admin@example.com", "password"=>"[FILTERED]"}, "commit"=>"Sign in"}
10241
+ Admin Load (0.7ms) SELECT "admins".* FROM "admins" WHERE "admins"."email" = ? ORDER BY "admins"."id" DESC LIMIT 1 [["email", "admin@example.com"]]
10242
+ Redirected to http://www.lvh.me:3000/
10243
+ Completed 302 Found in 24ms (ActiveRecord: 3.3ms)
10244
+
10245
+
10246
+ Started GET "/" for 127.0.0.1 at 2015-07-14 00:30:20 +0900
10247
+ Processing by PagesController#index as HTML
10248
+ Rendered pages/index.html.erb within layouts/application (0.0ms)
10249
+ Completed 500 Internal Server Error in 69038ms
10250
+
10251
+ SystemExit (exit):
10252
+ app/views/layouts/application.html.erb:19:in `_app_views_layouts_application_html_erb__4346455556384825248_70271731560140'
10253
+
10254
+
10255
+ Rendered /Users/koshikawa/repository/github.com/ppworks/nyauth/vendor/bundle/gems/actionpack-4.2.0/lib/action_dispatch/middleware/templates/rescues/_source.erb (7.8ms)
10256
+ Rendered /Users/koshikawa/repository/github.com/ppworks/nyauth/vendor/bundle/gems/actionpack-4.2.0/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (3.3ms)
10257
+ Rendered /Users/koshikawa/repository/github.com/ppworks/nyauth/vendor/bundle/gems/actionpack-4.2.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.0ms)
10258
+ Rendered /Users/koshikawa/repository/github.com/ppworks/nyauth/vendor/bundle/gems/actionpack-4.2.0/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (50.9ms)
10259
+
10260
+
10261
+ Started GET "/" for 127.0.0.1 at 2015-07-14 00:31:53 +0900
10262
+ Processing by PagesController#index as HTML
10263
+ Rendered pages/index.html.erb within layouts/application (0.1ms)
10264
+ Admin Load (0.4ms) SELECT "admins".* FROM "admins" WHERE "admins"."id" = ? LIMIT 1 [["id", 1]]
10265
+ CACHE (0.0ms) SELECT "admins".* FROM "admins" WHERE "admins"."id" = ? LIMIT 1 [["id", "1"]]
10266
+ Completed 200 OK in 32ms (Views: 31.0ms | ActiveRecord: 0.9ms)
10267
+
10268
+
10269
+ Started GET "/assets/jquery.self-d03a5518f45df77341bdbe6201ba3bfa547ebba8ed64f0ea56bfa5f96ea7c074.js?body=1" for 127.0.0.1 at 2015-07-14 00:31:53 +0900
10270
+
10271
+
10272
+ Started GET "/assets/application.self-e80e8f2318043e8af94dddc2adad5a4f09739a8ebb323b3ab31cd71d45fd9113.css?body=1" for 127.0.0.1 at 2015-07-14 00:31:53 +0900
10273
+
10274
+
10275
+ Started GET "/assets/jquery_ujs.self-ca5248a2fad13d6bd58ea121318d642f195f0b2dd818b30615f785ff365e8d1f.js?body=1" for 127.0.0.1 at 2015-07-14 00:31:53 +0900
10276
+
10277
+
10278
+ Started GET "/assets/application.self-2b00c68320848afe54cf9919a7a76ed257f93bdb6e12dc2160d07a8b1fe5e9f4.js?body=1" for 127.0.0.1 at 2015-07-14 00:31:53 +0900
10279
+
10280
+
10281
+ Started DELETE "/admin/session" for 127.0.0.1 at 2015-07-14 00:31:55 +0900
10282
+ Processing by Nyauth::SessionsController#destroy as HTML
10283
+ Parameters: {"authenticity_token"=>"M8/b3YxSzUs42vo7Xj2kg9dv/bprtZtcCQUaDaRdeWXNJUT23F0HIzrrdDpjs1y/1Rx5Z8xKP43tX7RK4GO/fw=="}
10284
+ Admin Load (0.1ms) SELECT "admins".* FROM "admins" WHERE "admins"."id" = ? LIMIT 1 [["id", 1]]
10285
+ CACHE (0.0ms) SELECT "admins".* FROM "admins" WHERE "admins"."id" = ? LIMIT 1 [["id", "1"]]
10286
+ Redirected to http://www.lvh.me:3000/admin/session/new
10287
+ Completed 302 Found in 13ms (ActiveRecord: 0.1ms)
10288
+
10289
+
10290
+ Started GET "/admin/session/new" for 127.0.0.1 at 2015-07-14 00:31:55 +0900
10291
+ Processing by Nyauth::SessionsController#new as HTML
10292
+ Rendered /Users/koshikawa/repository/github.com/ppworks/nyauth/app/views/nyauth/sessions/new.html.erb within layouts/application (6.5ms)
10293
+ Completed 200 OK in 22ms (Views: 20.3ms | ActiveRecord: 0.0ms)
10294
+
10295
+
10296
+ Started POST "/admin/session" for 127.0.0.1 at 2015-07-14 00:31:56 +0900
10297
+ Processing by Nyauth::SessionsController#create as HTML
10298
+ Parameters: {"utf8"=>"✓", "authenticity_token"=>"xljiooP+gYiIvb5c1clxqnk0c+jbuTWHyYYJ6gDF6Qfpwt7mWg5W7tv0R2nGcFJlxJ6kGK0LVBD7/ZFt8uagYg==", "session_service"=>{"email"=>"admin@example.com", "password"=>"[FILTERED]"}, "commit"=>"Sign in"}
10299
+ Admin Load (0.6ms) SELECT "admins".* FROM "admins" WHERE "admins"."email" = ? ORDER BY "admins"."id" DESC LIMIT 1 [["email", "admin@example.com"]]
10300
+ Redirected to http://www.lvh.me:3000/
10301
+ Completed 302 Found in 14ms (ActiveRecord: 0.6ms)
10302
+
10303
+
10304
+ Started GET "/" for 127.0.0.1 at 2015-07-14 00:31:56 +0900
10305
+ Processing by PagesController#index as HTML
10306
+ Rendered pages/index.html.erb within layouts/application (0.0ms)
10307
+ Admin Load (0.1ms) SELECT "admins".* FROM "admins" WHERE "admins"."id" = ? LIMIT 1 [["id", 1]]
10308
+ CACHE (0.0ms) SELECT "admins".* FROM "admins" WHERE "admins"."id" = ? LIMIT 1 [["id", "1"]]
10309
+ Completed 200 OK in 25ms (Views: 24.4ms | ActiveRecord: 0.1ms)
10310
+
10311
+
10312
+ Started DELETE "/admin/session" for 127.0.0.1 at 2015-07-14 00:31:57 +0900
10313
+ Processing by Nyauth::SessionsController#destroy as HTML
10314
+ Parameters: {"authenticity_token"=>"Hm3V0rzEGL4bTvZpNoAiX1Wo7c2CrbNLnjk6RVe3fUQx9+mWZTTP2EgHD1wlOQGQ6AI6PfQf0tysQqLCpZQ0IQ=="}
10315
+ Admin Load (0.2ms) SELECT "admins".* FROM "admins" WHERE "admins"."id" = ? LIMIT 1 [["id", 1]]
10316
+ CACHE (0.0ms) SELECT "admins".* FROM "admins" WHERE "admins"."id" = ? LIMIT 1 [["id", "1"]]
10317
+ Redirected to http://www.lvh.me:3000/admin/session/new
10318
+ Completed 302 Found in 18ms (ActiveRecord: 0.2ms)
10319
+
10320
+
10321
+ Started GET "/admin/session/new" for 127.0.0.1 at 2015-07-14 00:31:57 +0900
10322
+ Processing by Nyauth::SessionsController#new as HTML
10323
+ Rendered /Users/koshikawa/repository/github.com/ppworks/nyauth/app/views/nyauth/sessions/new.html.erb within layouts/application (6.9ms)
10324
+ Completed 200 OK in 25ms (Views: 24.8ms | ActiveRecord: 0.0ms)