knock 1.0.0 → 1.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 46f1a22cb830cb7a64bedd8d620ce451eb3f6b47
4
- data.tar.gz: a231975e3825cd248afd14f88f00c95f46fbc924
3
+ metadata.gz: 34a5224d9f1ba673a4e1c7f7fb086273c411807b
4
+ data.tar.gz: 01793137d8e2c8c8eadc4a9798eda8cdf7af2b28
5
5
  SHA512:
6
- metadata.gz: c387fc4242247a9c8b5e93d1a4aa9d511c9465e5a7cb509e8ed1bc672a942db6068a32bc84f6fe3e1ce1b2233657dacd11974c402d1d5b15984b950c896beb7a
7
- data.tar.gz: cf6e78431e45bf23db81b702466708ec36534c0714a798c26a546bb6670045d20f4f0de078b1fa91c8e02554f6f3ec0320153aea748bc78930472e07ed3d7f07
6
+ metadata.gz: 8a91b399a74e0d7f5954483fd7c07b46e47bf6406b1985f5b39142c930a66a858373d437dcc746eb7f069abd62ec82238333ff1c20f6b4e3bcd4927b46007409
7
+ data.tar.gz: db32aa96f986f5294b8d2ad8a8e6606b3d1469bc26c73e58a6ec82bb966e30bb672ea58ee7a581de12c07c80556ccdbeb0457895ee0b8982acd63c1a01eadc7a
@@ -1,31 +1,33 @@
1
1
  require 'jwt'
2
2
 
3
3
  module Knock
4
- cattr_accessor :token_lifetime
5
-
6
- def self.token_lifetime
7
- @token_lifetime || 1.day
8
- end
9
-
10
4
  class AuthToken
11
5
  attr_reader :token
12
6
 
13
7
  def initialize payload: {}, token: nil
14
- if token.nil?
15
- @token = JWT.encode ({ exp: expiration_time }).merge(payload), Rails.application.secrets.secret_key_base, 'HS256'
16
- else
17
- @token = token
18
- end
8
+ @token = token || JWT.encode(claims.merge(payload), key, 'HS256')
19
9
  end
20
10
 
21
11
  def validate!
22
- JWT.decode @token, Rails.application.secrets.secret_key_base
12
+ JWT.decode @token, key, true, verify_claims
23
13
  end
24
14
 
25
15
  private
16
+ def key
17
+ Knock.token_secret_signature_key.call
18
+ end
19
+
20
+ def claims
21
+ {
22
+ exp: Knock.token_lifetime.from_now.to_i,
23
+ aud: Knock.token_audience
24
+ }
25
+ end
26
26
 
27
- def expiration_time
28
- Knock.token_lifetime.from_now.to_i
27
+ def verify_claims
28
+ {
29
+ aud: Knock.token_audience, verify_claims: Knock.token_audience.present?
30
+ }
29
31
  end
30
32
  end
31
33
  end
@@ -0,0 +1,11 @@
1
+ module Knock
2
+ class InstallGenerator < Rails::Generators::Base
3
+ source_root File.expand_path("../../templates", __FILE__)
4
+
5
+ desc "Creates a Knock initializer."
6
+
7
+ def copy_initializer
8
+ template 'knock.rb', 'config/initializers/knock.rb'
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,36 @@
1
+ Knock.setup do |config|
2
+
3
+ ## Expiration claim
4
+ ## ----------------
5
+ ##
6
+ ## How long before a token is expired.
7
+ ##
8
+ ## Default:
9
+ # config.token_lifetime = 1.day
10
+
11
+
12
+ ## Audience claim
13
+ ## --------------
14
+ ##
15
+ ## Configure the audience claim to indentify the recipients that the token
16
+ ## is intended for.
17
+ ##
18
+ ## Default:
19
+ # config.token_audience = nil
20
+
21
+ ## If using Auth0, uncomment the line below
22
+ # config.token_audience = -> { Rails.application.secrets.auth0_client_id }
23
+
24
+
25
+ ## Signature key
26
+ ## -------------
27
+ ##
28
+ ## Configure the key used to sign tokens.
29
+ ##
30
+ ## Default:
31
+ # config.token_secret_signature_key = -> { Rails.application.secrets.secret_key_base }
32
+
33
+ ## If using Auth0, uncomment the line below
34
+ # config.token_secret_signature_key = -> { Rails.application.secrets.auth0_client_secret }
35
+
36
+ end
@@ -1,4 +1,19 @@
1
1
  require "knock/engine"
2
2
 
3
3
  module Knock
4
+
5
+ mattr_accessor :token_lifetime
6
+ self.token_lifetime = 1.day
7
+
8
+ mattr_accessor :token_audience
9
+ self.token_audience = nil
10
+
11
+ mattr_accessor :token_secret_signature_key
12
+ self.token_secret_signature_key = -> { Rails.application.secrets.secret_key_base }
13
+
14
+ # Default way to setup Knock. Run rails generate knock_install to create
15
+ # a fresh initializer with all configuration values.
16
+ def self.setup
17
+ yield self
18
+ end
4
19
  end
@@ -1,3 +1,3 @@
1
1
  module Knock
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0.rc1"
3
3
  end
Binary file
File without changes
@@ -3037,3 +3037,668 @@ Processing by Knock::AuthTokenController#create as HTML
3037
3037
  User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
3038
3038
  Completed 404 Not Found in 2ms (ActiveRecord: 0.0ms)
3039
3039
   (0.1ms) rollback transaction
3040
+ ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
3041
+  (0.1ms) begin transaction
3042
+ Fixture Delete (0.6ms) DELETE FROM "users"
3043
+ Fixture Insert (0.4ms) INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('one@example.net', '$2a$04$Vh.dppWW2pQ48kP01lrdHuoMlT2HPDN0sDRv6f3Vya9CHaaLMbkvG', '2015-07-15 15:18:12', '2015-07-15 15:18:12', 980190962)
3044
+ Fixture Insert (0.1ms) INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('two@example.net', '$2a$04$KRkMwj0qRbsiSSHeFH0M9OqV8ByqTzynVahzZVNUo4xR9RSqOcUqa', '2015-07-15 15:18:12', '2015-07-15 15:18:12', 298486374)
3045
+  (0.7ms) commit transaction
3046
+  (0.0ms) begin transaction
3047
+ -----------------------------------------------------------------
3048
+ ProtectedResourcesControllerTest: test_responds_with_unauthorized
3049
+ -----------------------------------------------------------------
3050
+ Processing by ProtectedResourcesController#index as HTML
3051
+ Filter chain halted as :authenticate rendered or redirected
3052
+ Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
3053
+  (0.1ms) rollback transaction
3054
+  (0.0ms) begin transaction
3055
+ -----------------------------------------------------------------------------
3056
+ ProtectedResourcesControllerTest: test_responds_with_success_if_authenticated
3057
+ -----------------------------------------------------------------------------
3058
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3059
+  (0.1ms) rollback transaction
3060
+  (0.0ms) begin transaction
3061
+ ------------------------------------------------------------------------------
3062
+ ProtectedResourcesControllerTest: test_has_a_current_user_after_authentication
3063
+ ------------------------------------------------------------------------------
3064
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3065
+  (0.0ms) rollback transaction
3066
+  (0.1ms) begin transaction
3067
+ -----------------------------------------------------------------------------
3068
+ Knock::AuthTokenControllerTest: test_responds_with_404_if_user_does_not_exist
3069
+ -----------------------------------------------------------------------------
3070
+ Processing by Knock::AuthTokenController#create as HTML
3071
+ Parameters: {"auth"=>{"email"=>"wrong@example.net", "password"=>"[FILTERED]"}}
3072
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "wrong@example.net"]]
3073
+ Completed 404 Not Found in 2ms (ActiveRecord: 0.1ms)
3074
+  (0.1ms) rollback transaction
3075
+  (0.0ms) begin transaction
3076
+ ------------------------------------------------------
3077
+ Knock::AuthTokenControllerTest: test_responds_with_201
3078
+ ------------------------------------------------------
3079
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3080
+ Processing by Knock::AuthTokenController#create as HTML
3081
+ Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
3082
+ User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
3083
+ Completed 500 Internal Server Error in 2ms (ActiveRecord: 0.0ms)
3084
+  (0.1ms) rollback transaction
3085
+  (0.1ms) begin transaction
3086
+ -----------------------------------------------------------------------------
3087
+ Knock::AuthTokenControllerTest: test_responds_with_404_if_password_is_invalid
3088
+ -----------------------------------------------------------------------------
3089
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3090
+ Processing by Knock::AuthTokenController#create as HTML
3091
+ Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
3092
+ User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
3093
+ Completed 404 Not Found in 2ms (ActiveRecord: 0.0ms)
3094
+  (0.0ms) rollback transaction
3095
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
3096
+  (0.1ms) begin transaction
3097
+ Fixture Delete (0.3ms) DELETE FROM "users"
3098
+ Fixture Insert (0.1ms) INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('one@example.net', '$2a$04$JA/c3tX2pzobkPi4aAUieOJ.B/TrkcodoPIWrUKSvcvfErhgG1PLy', '2015-07-15 15:22:16', '2015-07-15 15:22:16', 980190962)
3099
+ Fixture Insert (0.0ms) INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('two@example.net', '$2a$04$97PYmwJzgeb2f33/QMOdQ.p5GH/qrTDGgoQIzmWwnUi4duUgUW1xy', '2015-07-15 15:22:16', '2015-07-15 15:22:16', 298486374)
3100
+  (1.4ms) commit transaction
3101
+  (0.1ms) begin transaction
3102
+ ------------------------------------------------------
3103
+ Knock::AuthTokenControllerTest: test_responds_with_201
3104
+ ------------------------------------------------------
3105
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3106
+ Processing by Knock::AuthTokenController#create as HTML
3107
+ Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
3108
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
3109
+ Completed 500 Internal Server Error in 5ms (ActiveRecord: 0.1ms)
3110
+  (0.1ms) rollback transaction
3111
+  (0.0ms) begin transaction
3112
+ -----------------------------------------------------------------------------
3113
+ Knock::AuthTokenControllerTest: test_responds_with_404_if_password_is_invalid
3114
+ -----------------------------------------------------------------------------
3115
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3116
+ Processing by Knock::AuthTokenController#create as HTML
3117
+ Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
3118
+ User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
3119
+ Completed 404 Not Found in 2ms (ActiveRecord: 0.0ms)
3120
+  (0.0ms) rollback transaction
3121
+  (0.0ms) begin transaction
3122
+ -----------------------------------------------------------------------------
3123
+ Knock::AuthTokenControllerTest: test_responds_with_404_if_user_does_not_exist
3124
+ -----------------------------------------------------------------------------
3125
+ Processing by Knock::AuthTokenController#create as HTML
3126
+ Parameters: {"auth"=>{"email"=>"wrong@example.net", "password"=>"[FILTERED]"}}
3127
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "wrong@example.net"]]
3128
+ Completed 404 Not Found in 0ms (ActiveRecord: 0.1ms)
3129
+  (0.1ms) rollback transaction
3130
+  (0.0ms) begin transaction
3131
+ -----------------------------------------------------------------------------
3132
+ ProtectedResourcesControllerTest: test_responds_with_success_if_authenticated
3133
+ -----------------------------------------------------------------------------
3134
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3135
+  (0.0ms) rollback transaction
3136
+  (0.1ms) begin transaction
3137
+ ------------------------------------------------------------------------------
3138
+ ProtectedResourcesControllerTest: test_has_a_current_user_after_authentication
3139
+ ------------------------------------------------------------------------------
3140
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3141
+  (0.0ms) rollback transaction
3142
+  (0.1ms) begin transaction
3143
+ -----------------------------------------------------------------
3144
+ ProtectedResourcesControllerTest: test_responds_with_unauthorized
3145
+ -----------------------------------------------------------------
3146
+ Processing by ProtectedResourcesController#index as HTML
3147
+ Filter chain halted as :authenticate rendered or redirected
3148
+ Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
3149
+  (0.0ms) rollback transaction
3150
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
3151
+  (0.1ms) begin transaction
3152
+ Fixture Delete (0.2ms) DELETE FROM "users"
3153
+ Fixture Insert (0.1ms) INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('one@example.net', '$2a$04$Kn4Zr/SXViCsMoxESW1p9OlGqqoSmunb5fYYElgtScakdLV713k3a', '2015-07-15 15:22:51', '2015-07-15 15:22:51', 980190962)
3154
+ Fixture Insert (0.1ms) INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('two@example.net', '$2a$04$c0mQYlFm3uH3.q4VFZ8H..gTkiLLBOV8KBWLFAsDtKV2uZkrfwvVO', '2015-07-15 15:22:51', '2015-07-15 15:22:51', 298486374)
3155
+  (1.6ms) commit transaction
3156
+  (0.1ms) begin transaction
3157
+ -----------------------------------------------------------------------------
3158
+ Knock::AuthTokenControllerTest: test_responds_with_404_if_user_does_not_exist
3159
+ -----------------------------------------------------------------------------
3160
+ Processing by Knock::AuthTokenController#create as HTML
3161
+ Parameters: {"auth"=>{"email"=>"wrong@example.net", "password"=>"[FILTERED]"}}
3162
+ User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "wrong@example.net"]]
3163
+ Completed 404 Not Found in 9ms (ActiveRecord: 0.4ms)
3164
+  (0.1ms) rollback transaction
3165
+  (0.1ms) begin transaction
3166
+ -----------------------------------------------------------------------------
3167
+ Knock::AuthTokenControllerTest: test_responds_with_404_if_password_is_invalid
3168
+ -----------------------------------------------------------------------------
3169
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3170
+ Processing by Knock::AuthTokenController#create as HTML
3171
+ Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
3172
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
3173
+ Completed 404 Not Found in 2ms (ActiveRecord: 0.1ms)
3174
+  (0.1ms) rollback transaction
3175
+  (0.1ms) begin transaction
3176
+ ------------------------------------------------------
3177
+ Knock::AuthTokenControllerTest: test_responds_with_201
3178
+ ------------------------------------------------------
3179
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3180
+ Processing by Knock::AuthTokenController#create as HTML
3181
+ Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
3182
+ User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
3183
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
3184
+ Completed 201 Created in 13ms (Views: 0.2ms | ActiveRecord: 0.1ms)
3185
+  (0.1ms) rollback transaction
3186
+  (0.0ms) begin transaction
3187
+ ------------------------------------------------------------------------------
3188
+ ProtectedResourcesControllerTest: test_has_a_current_user_after_authentication
3189
+ ------------------------------------------------------------------------------
3190
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3191
+ Processing by ProtectedResourcesController#index as HTML
3192
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3193
+ Completed 200 OK in 1ms (ActiveRecord: 0.1ms)
3194
+  (0.1ms) rollback transaction
3195
+  (0.1ms) begin transaction
3196
+ -----------------------------------------------------------------
3197
+ ProtectedResourcesControllerTest: test_responds_with_unauthorized
3198
+ -----------------------------------------------------------------
3199
+ Processing by ProtectedResourcesController#index as HTML
3200
+ Filter chain halted as :authenticate rendered or redirected
3201
+ Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
3202
+  (0.0ms) rollback transaction
3203
+  (0.1ms) begin transaction
3204
+ -----------------------------------------------------------------------------
3205
+ ProtectedResourcesControllerTest: test_responds_with_success_if_authenticated
3206
+ -----------------------------------------------------------------------------
3207
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3208
+ Processing by ProtectedResourcesController#index as HTML
3209
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3210
+ Completed 200 OK in 1ms (ActiveRecord: 0.1ms)
3211
+  (0.1ms) rollback transaction
3212
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
3213
+  (0.1ms) begin transaction
3214
+ Fixture Delete (0.3ms) DELETE FROM "users"
3215
+ Fixture Insert (0.1ms) INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('one@example.net', '$2a$04$lQ6dep8WROuC2WVuFMZNcu9haVkPTY.LPbJKnO.CZ47zwqrH0fYfm', '2015-07-15 15:25:07', '2015-07-15 15:25:07', 980190962)
3216
+ Fixture Insert (0.0ms) INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('two@example.net', '$2a$04$MRqP183P9yUjD5x8RQhjUOx6J7auUoBRJRfIfJBLTFCmEcG9UTKhO', '2015-07-15 15:25:07', '2015-07-15 15:25:07', 298486374)
3217
+  (0.7ms) commit transaction
3218
+  (0.0ms) begin transaction
3219
+ ------------------------------------------------------
3220
+ Knock::AuthTokenControllerTest: test_responds_with_201
3221
+ ------------------------------------------------------
3222
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3223
+ Processing by Knock::AuthTokenController#create as HTML
3224
+ Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
3225
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
3226
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
3227
+ Completed 201 Created in 12ms (Views: 0.2ms | ActiveRecord: 0.3ms)
3228
+  (0.1ms) rollback transaction
3229
+  (0.1ms) begin transaction
3230
+ -----------------------------------------------------------------------------
3231
+ Knock::AuthTokenControllerTest: test_responds_with_404_if_password_is_invalid
3232
+ -----------------------------------------------------------------------------
3233
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3234
+ Processing by Knock::AuthTokenController#create as HTML
3235
+ Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
3236
+ User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
3237
+ Completed 404 Not Found in 2ms (ActiveRecord: 0.0ms)
3238
+  (0.1ms) rollback transaction
3239
+  (0.0ms) begin transaction
3240
+ -----------------------------------------------------------------------------
3241
+ Knock::AuthTokenControllerTest: test_responds_with_404_if_user_does_not_exist
3242
+ -----------------------------------------------------------------------------
3243
+ Processing by Knock::AuthTokenController#create as HTML
3244
+ Parameters: {"auth"=>{"email"=>"wrong@example.net", "password"=>"[FILTERED]"}}
3245
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "wrong@example.net"]]
3246
+ Completed 404 Not Found in 0ms (ActiveRecord: 0.1ms)
3247
+  (0.0ms) rollback transaction
3248
+  (0.0ms) begin transaction
3249
+ -----------------------------------------------------------------
3250
+ ProtectedResourcesControllerTest: test_responds_with_unauthorized
3251
+ -----------------------------------------------------------------
3252
+ Processing by ProtectedResourcesController#index as HTML
3253
+ Filter chain halted as :authenticate rendered or redirected
3254
+ Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
3255
+  (0.1ms) rollback transaction
3256
+  (0.1ms) begin transaction
3257
+ -----------------------------------------------------------------------------
3258
+ ProtectedResourcesControllerTest: test_responds_with_success_if_authenticated
3259
+ -----------------------------------------------------------------------------
3260
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3261
+ Processing by ProtectedResourcesController#index as HTML
3262
+ User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3263
+ Completed 200 OK in 1ms (ActiveRecord: 0.0ms)
3264
+  (0.0ms) rollback transaction
3265
+  (0.1ms) begin transaction
3266
+ ------------------------------------------------------------------------------
3267
+ ProtectedResourcesControllerTest: test_has_a_current_user_after_authentication
3268
+ ------------------------------------------------------------------------------
3269
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3270
+ Processing by ProtectedResourcesController#index as HTML
3271
+ User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3272
+ Completed 200 OK in 1ms (ActiveRecord: 0.0ms)
3273
+  (0.1ms) rollback transaction
3274
+ ActiveRecord::SchemaMigration Load (0.5ms) SELECT "schema_migrations".* FROM "schema_migrations"
3275
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
3276
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
3277
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
3278
+  (0.1ms) begin transaction
3279
+ Fixture Delete (0.8ms) DELETE FROM "users"
3280
+ Fixture Insert (0.5ms) INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('one@example.net', '$2a$04$12chVEEM0IZUMTt6O2ynKOaFlfnfvBU/1i2zbgssze/RMcq6oFMPS', '2015-07-15 15:58:13', '2015-07-15 15:58:13', 980190962)
3281
+ Fixture Insert (0.1ms) INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('two@example.net', '$2a$04$Ppavg2UpH39R7WuSrxjpku2z5m080vXfROtes0BYpWSFUo9V0Gi92', '2015-07-15 15:58:13', '2015-07-15 15:58:13', 298486374)
3282
+  (0.9ms) commit transaction
3283
+  (0.1ms) begin transaction
3284
+ ----------------------------------------------------------------
3285
+ InstallGeneratorTest: test_Assert_all_files_are_properly_created
3286
+ ----------------------------------------------------------------
3287
+  (0.1ms) rollback transaction
3288
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
3289
+  (0.1ms) begin transaction
3290
+ Fixture Delete (0.3ms) DELETE FROM "users"
3291
+ Fixture Insert (0.1ms) INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('one@example.net', '$2a$04$jMqvvyPOfw.htkdb29BbZ.ozW4KCcDSyZRfooYXUBYW2W.Q0mSVs.', '2015-07-15 15:58:27', '2015-07-15 15:58:27', 980190962)
3292
+ Fixture Insert (0.0ms) INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('two@example.net', '$2a$04$e6lXwGBSU7QWwDL1D12V4.GXqhXWZU1sMSuWTDV44DxvCZqPMIrNu', '2015-07-15 15:58:27', '2015-07-15 15:58:27', 298486374)
3293
+  (1.0ms) commit transaction
3294
+  (0.1ms) begin transaction
3295
+ ------------------------------------------------------------------------------
3296
+ ProtectedResourcesControllerTest: test_has_a_current_user_after_authentication
3297
+ ------------------------------------------------------------------------------
3298
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3299
+ Processing by ProtectedResourcesController#index as HTML
3300
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3301
+ Completed 200 OK in 2ms (ActiveRecord: 0.1ms)
3302
+  (0.1ms) rollback transaction
3303
+  (0.0ms) begin transaction
3304
+ -----------------------------------------------------------------
3305
+ ProtectedResourcesControllerTest: test_responds_with_unauthorized
3306
+ -----------------------------------------------------------------
3307
+ Processing by ProtectedResourcesController#index as HTML
3308
+ Filter chain halted as :authenticate rendered or redirected
3309
+ Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
3310
+  (0.0ms) rollback transaction
3311
+  (0.0ms) begin transaction
3312
+ -----------------------------------------------------------------------------
3313
+ ProtectedResourcesControllerTest: test_responds_with_success_if_authenticated
3314
+ -----------------------------------------------------------------------------
3315
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3316
+ Processing by ProtectedResourcesController#index as HTML
3317
+ User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3318
+ Completed 200 OK in 0ms (ActiveRecord: 0.0ms)
3319
+  (0.0ms) rollback transaction
3320
+  (0.0ms) begin transaction
3321
+ -----------------------------------------------------------------------------
3322
+ Knock::AuthTokenControllerTest: test_responds_with_404_if_password_is_invalid
3323
+ -----------------------------------------------------------------------------
3324
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3325
+ Processing by Knock::AuthTokenController#create as HTML
3326
+ Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
3327
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
3328
+ Completed 404 Not Found in 2ms (ActiveRecord: 0.1ms)
3329
+  (0.0ms) rollback transaction
3330
+  (0.0ms) begin transaction
3331
+ -----------------------------------------------------------------------------
3332
+ Knock::AuthTokenControllerTest: test_responds_with_404_if_user_does_not_exist
3333
+ -----------------------------------------------------------------------------
3334
+ Processing by Knock::AuthTokenController#create as HTML
3335
+ Parameters: {"auth"=>{"email"=>"wrong@example.net", "password"=>"[FILTERED]"}}
3336
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "wrong@example.net"]]
3337
+ Completed 404 Not Found in 0ms (ActiveRecord: 0.1ms)
3338
+  (0.0ms) rollback transaction
3339
+  (0.0ms) begin transaction
3340
+ ------------------------------------------------------
3341
+ Knock::AuthTokenControllerTest: test_responds_with_201
3342
+ ------------------------------------------------------
3343
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3344
+ Processing by Knock::AuthTokenController#create as HTML
3345
+ Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
3346
+ User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
3347
+ User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
3348
+ Completed 201 Created in 2ms (Views: 0.1ms | ActiveRecord: 0.1ms)
3349
+  (0.0ms) rollback transaction
3350
+  (0.0ms) begin transaction
3351
+ ----------------------------------------------------------------
3352
+ InstallGeneratorTest: test_Assert_all_files_are_properly_created
3353
+ ----------------------------------------------------------------
3354
+  (0.1ms) rollback transaction
3355
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
3356
+  (0.1ms) begin transaction
3357
+ Fixture Delete (0.2ms) DELETE FROM "users"
3358
+ Fixture Insert (0.1ms) INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('one@example.net', '$2a$04$Ze9d59FVmGT7IJwhGho9cewSEEkarQ1Jd0BNvshALz4cW7TPr3cNS', '2015-07-15 15:58:35', '2015-07-15 15:58:35', 980190962)
3359
+ Fixture Insert (0.0ms) INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('two@example.net', '$2a$04$9HsNAOfKKBNE8Gli.31H6Ob1Ots089NvBe0L1uzNkoo7Dz9dUAiTe', '2015-07-15 15:58:35', '2015-07-15 15:58:35', 298486374)
3360
+  (1.5ms) commit transaction
3361
+  (0.1ms) begin transaction
3362
+ -----------------------------------------------------------------------------
3363
+ Knock::AuthTokenControllerTest: test_responds_with_404_if_user_does_not_exist
3364
+ -----------------------------------------------------------------------------
3365
+ Processing by Knock::AuthTokenController#create as HTML
3366
+ Parameters: {"auth"=>{"email"=>"wrong@example.net", "password"=>"[FILTERED]"}}
3367
+ User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "wrong@example.net"]]
3368
+ Completed 404 Not Found in 18ms (ActiveRecord: 0.4ms)
3369
+  (0.1ms) rollback transaction
3370
+  (0.0ms) begin transaction
3371
+ -----------------------------------------------------------------------------
3372
+ Knock::AuthTokenControllerTest: test_responds_with_404_if_password_is_invalid
3373
+ -----------------------------------------------------------------------------
3374
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3375
+ Processing by Knock::AuthTokenController#create as HTML
3376
+ Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
3377
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
3378
+ Completed 404 Not Found in 2ms (ActiveRecord: 0.1ms)
3379
+  (0.1ms) rollback transaction
3380
+  (0.0ms) begin transaction
3381
+ ------------------------------------------------------
3382
+ Knock::AuthTokenControllerTest: test_responds_with_201
3383
+ ------------------------------------------------------
3384
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3385
+ Processing by Knock::AuthTokenController#create as HTML
3386
+ Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
3387
+ User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
3388
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
3389
+ Completed 201 Created in 7ms (Views: 0.2ms | ActiveRecord: 0.1ms)
3390
+  (0.1ms) rollback transaction
3391
+  (0.0ms) begin transaction
3392
+ ------------------------------------------------------------------------------
3393
+ ProtectedResourcesControllerTest: test_has_a_current_user_after_authentication
3394
+ ------------------------------------------------------------------------------
3395
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3396
+ Processing by ProtectedResourcesController#index as HTML
3397
+ User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3398
+ Completed 200 OK in 1ms (ActiveRecord: 0.0ms)
3399
+  (0.1ms) rollback transaction
3400
+  (0.0ms) begin transaction
3401
+ -----------------------------------------------------------------------------
3402
+ ProtectedResourcesControllerTest: test_responds_with_success_if_authenticated
3403
+ -----------------------------------------------------------------------------
3404
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3405
+ Processing by ProtectedResourcesController#index as HTML
3406
+ User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3407
+ Completed 200 OK in 0ms (ActiveRecord: 0.0ms)
3408
+  (0.0ms) rollback transaction
3409
+  (0.1ms) begin transaction
3410
+ -----------------------------------------------------------------
3411
+ ProtectedResourcesControllerTest: test_responds_with_unauthorized
3412
+ -----------------------------------------------------------------
3413
+ Processing by ProtectedResourcesController#index as HTML
3414
+ Filter chain halted as :authenticate rendered or redirected
3415
+ Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
3416
+  (0.0ms) rollback transaction
3417
+  (0.0ms) begin transaction
3418
+ ----------------------------------------------------------------
3419
+ InstallGeneratorTest: test_Assert_all_files_are_properly_created
3420
+ ----------------------------------------------------------------
3421
+  (0.1ms) rollback transaction
3422
+ ActiveRecord::SchemaMigration Load (0.5ms) SELECT "schema_migrations".* FROM "schema_migrations"
3423
+  (0.1ms) begin transaction
3424
+ Fixture Delete (0.9ms) DELETE FROM "users"
3425
+ Fixture Insert (0.5ms) INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('one@example.net', '$2a$04$VfCCl/ZVmwkH2QEebT/zUu36PwSNQwCL04UCSXU1fijFnGgU9HfnS', '2015-07-15 16:12:21', '2015-07-15 16:12:21', 980190962)
3426
+ Fixture Insert (0.1ms) INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('two@example.net', '$2a$04$MPBCItViZiI7sB2vL7ZrbexzWVQaxxIOOe0Z6083Ycq3ebsZ8vUrS', '2015-07-15 16:12:21', '2015-07-15 16:12:21', 298486374)
3427
+  (0.7ms) commit transaction
3428
+  (0.0ms) begin transaction
3429
+ ------------------------------------------------------------------------------
3430
+ ProtectedResourcesControllerTest: test_has_a_current_user_after_authentication
3431
+ ------------------------------------------------------------------------------
3432
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3433
+ Processing by ProtectedResourcesController#index as HTML
3434
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3435
+ Completed 200 OK in 2ms (ActiveRecord: 0.1ms)
3436
+  (0.1ms) rollback transaction
3437
+  (0.0ms) begin transaction
3438
+ -----------------------------------------------------------------
3439
+ ProtectedResourcesControllerTest: test_responds_with_unauthorized
3440
+ -----------------------------------------------------------------
3441
+ Processing by ProtectedResourcesController#index as HTML
3442
+ Filter chain halted as :authenticate rendered or redirected
3443
+ Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
3444
+  (0.0ms) rollback transaction
3445
+  (0.1ms) begin transaction
3446
+ -----------------------------------------------------------------------------
3447
+ ProtectedResourcesControllerTest: test_responds_with_success_if_authenticated
3448
+ -----------------------------------------------------------------------------
3449
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3450
+ Processing by ProtectedResourcesController#index as HTML
3451
+ User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3452
+ Completed 200 OK in 0ms (ActiveRecord: 0.0ms)
3453
+  (0.0ms) rollback transaction
3454
+  (0.1ms) begin transaction
3455
+ ----------------------------------------------------------------
3456
+ InstallGeneratorTest: test_Assert_all_files_are_properly_created
3457
+ ----------------------------------------------------------------
3458
+  (0.1ms) rollback transaction
3459
+  (0.0ms) begin transaction
3460
+ ------------------------------------------------------
3461
+ Knock::AuthTokenControllerTest: test_responds_with_201
3462
+ ------------------------------------------------------
3463
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3464
+ Processing by Knock::AuthTokenController#create as HTML
3465
+ Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
3466
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
3467
+ User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
3468
+ Completed 201 Created in 3ms (Views: 0.1ms | ActiveRecord: 0.2ms)
3469
+  (0.1ms) rollback transaction
3470
+  (0.0ms) begin transaction
3471
+ -----------------------------------------------------------------------------
3472
+ Knock::AuthTokenControllerTest: test_responds_with_404_if_password_is_invalid
3473
+ -----------------------------------------------------------------------------
3474
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3475
+ Processing by Knock::AuthTokenController#create as HTML
3476
+ Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
3477
+ User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
3478
+ Completed 404 Not Found in 2ms (ActiveRecord: 0.0ms)
3479
+  (0.0ms) rollback transaction
3480
+  (0.1ms) begin transaction
3481
+ -----------------------------------------------------------------------------
3482
+ Knock::AuthTokenControllerTest: test_responds_with_404_if_user_does_not_exist
3483
+ -----------------------------------------------------------------------------
3484
+ Processing by Knock::AuthTokenController#create as HTML
3485
+ Parameters: {"auth"=>{"email"=>"wrong@example.net", "password"=>"[FILTERED]"}}
3486
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "wrong@example.net"]]
3487
+ Completed 404 Not Found in 0ms (ActiveRecord: 0.1ms)
3488
+  (0.0ms) rollback transaction
3489
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
3490
+  (0.1ms) begin transaction
3491
+ Fixture Delete (0.2ms) DELETE FROM "users"
3492
+ Fixture Insert (0.1ms) INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('one@example.net', '$2a$04$ECm2Ev8zjCnTUd.JW5IkVuwZAIwjsT9xRHZyMn7zJujBml9gsMYxO', '2015-07-15 16:13:45', '2015-07-15 16:13:45', 980190962)
3493
+ Fixture Insert (0.0ms) INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('two@example.net', '$2a$04$R/zDQvaVJ9FdXygihgMLUur1Yhzk0pmkz7qf4nvExEjbmpGF01yhu', '2015-07-15 16:13:45', '2015-07-15 16:13:45', 298486374)
3494
+  (1.5ms) commit transaction
3495
+  (0.1ms) begin transaction
3496
+ ------------------------------------------------------------------------------
3497
+ ProtectedResourcesControllerTest: test_has_a_current_user_after_authentication
3498
+ ------------------------------------------------------------------------------
3499
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3500
+ Processing by ProtectedResourcesController#index as HTML
3501
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3502
+ Completed 200 OK in 2ms (ActiveRecord: 0.1ms)
3503
+  (0.1ms) rollback transaction
3504
+  (0.0ms) begin transaction
3505
+ -----------------------------------------------------------------
3506
+ ProtectedResourcesControllerTest: test_responds_with_unauthorized
3507
+ -----------------------------------------------------------------
3508
+ Processing by ProtectedResourcesController#index as HTML
3509
+ Filter chain halted as :authenticate rendered or redirected
3510
+ Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
3511
+  (0.0ms) rollback transaction
3512
+  (0.0ms) begin transaction
3513
+ -----------------------------------------------------------------------------
3514
+ ProtectedResourcesControllerTest: test_responds_with_success_if_authenticated
3515
+ -----------------------------------------------------------------------------
3516
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3517
+ Processing by ProtectedResourcesController#index as HTML
3518
+ User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3519
+ Completed 200 OK in 0ms (ActiveRecord: 0.0ms)
3520
+  (0.0ms) rollback transaction
3521
+  (0.0ms) begin transaction
3522
+ -----------------------------------------------------------------------------
3523
+ Knock::AuthTokenControllerTest: test_responds_with_404_if_user_does_not_exist
3524
+ -----------------------------------------------------------------------------
3525
+ Processing by Knock::AuthTokenController#create as HTML
3526
+ Parameters: {"auth"=>{"email"=>"wrong@example.net", "password"=>"[FILTERED]"}}
3527
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "wrong@example.net"]]
3528
+ Completed 404 Not Found in 1ms (ActiveRecord: 0.1ms)
3529
+  (0.1ms) rollback transaction
3530
+  (0.1ms) begin transaction
3531
+ ------------------------------------------------------
3532
+ Knock::AuthTokenControllerTest: test_responds_with_201
3533
+ ------------------------------------------------------
3534
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3535
+ Processing by Knock::AuthTokenController#create as HTML
3536
+ Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
3537
+ User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
3538
+ User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
3539
+ Completed 201 Created in 2ms (Views: 0.1ms | ActiveRecord: 0.1ms)
3540
+  (0.0ms) rollback transaction
3541
+  (0.1ms) begin transaction
3542
+ -----------------------------------------------------------------------------
3543
+ Knock::AuthTokenControllerTest: test_responds_with_404_if_password_is_invalid
3544
+ -----------------------------------------------------------------------------
3545
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3546
+ Processing by Knock::AuthTokenController#create as HTML
3547
+ Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
3548
+ User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
3549
+ Completed 404 Not Found in 2ms (ActiveRecord: 0.0ms)
3550
+  (0.0ms) rollback transaction
3551
+  (0.0ms) begin transaction
3552
+ ----------------------------------------------------------------
3553
+ InstallGeneratorTest: test_Assert_all_files_are_properly_created
3554
+ ----------------------------------------------------------------
3555
+  (0.0ms) rollback transaction
3556
+  (0.0ms) begin transaction
3557
+ ---------------------------------------
3558
+ KnockTest: test_setup_block_yields_self
3559
+ ---------------------------------------
3560
+  (0.0ms) rollback transaction
3561
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
3562
+  (0.1ms) begin transaction
3563
+ Fixture Delete (0.2ms) DELETE FROM "users"
3564
+ Fixture Insert (0.1ms) INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('one@example.net', '$2a$04$ffjkG5TRoEGvTxub2Wv9Oea3R9yD.ZLLdk3Vx4ixdlE7jyqwz9bFW', '2015-07-15 16:14:05', '2015-07-15 16:14:05', 980190962)
3565
+ Fixture Insert (0.0ms) INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('two@example.net', '$2a$04$8AauzQEzp6ui7FyTlftZHOWsLinabqlYp4.7B.y.MPx1oj5nYFl/6', '2015-07-15 16:14:05', '2015-07-15 16:14:05', 298486374)
3566
+  (1.5ms) commit transaction
3567
+  (0.1ms) begin transaction
3568
+ ------------------------------------------------------------------------------
3569
+ ProtectedResourcesControllerTest: test_has_a_current_user_after_authentication
3570
+ ------------------------------------------------------------------------------
3571
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3572
+ Processing by ProtectedResourcesController#index as HTML
3573
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3574
+ Completed 200 OK in 2ms (ActiveRecord: 0.1ms)
3575
+  (0.1ms) rollback transaction
3576
+  (0.0ms) begin transaction
3577
+ -----------------------------------------------------------------
3578
+ ProtectedResourcesControllerTest: test_responds_with_unauthorized
3579
+ -----------------------------------------------------------------
3580
+ Processing by ProtectedResourcesController#index as HTML
3581
+ Filter chain halted as :authenticate rendered or redirected
3582
+ Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
3583
+  (0.0ms) rollback transaction
3584
+  (0.1ms) begin transaction
3585
+ -----------------------------------------------------------------------------
3586
+ ProtectedResourcesControllerTest: test_responds_with_success_if_authenticated
3587
+ -----------------------------------------------------------------------------
3588
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3589
+ Processing by ProtectedResourcesController#index as HTML
3590
+ User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3591
+ Completed 200 OK in 0ms (ActiveRecord: 0.0ms)
3592
+  (0.0ms) rollback transaction
3593
+  (0.0ms) begin transaction
3594
+ ----------------------------------------------------------------
3595
+ InstallGeneratorTest: test_Assert_all_files_are_properly_created
3596
+ ----------------------------------------------------------------
3597
+  (0.0ms) rollback transaction
3598
+  (0.0ms) begin transaction
3599
+ -----------------------------------------------------------------------------
3600
+ Knock::AuthTokenControllerTest: test_responds_with_404_if_user_does_not_exist
3601
+ -----------------------------------------------------------------------------
3602
+ Processing by Knock::AuthTokenController#create as HTML
3603
+ Parameters: {"auth"=>{"email"=>"wrong@example.net", "password"=>"[FILTERED]"}}
3604
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "wrong@example.net"]]
3605
+ Completed 404 Not Found in 1ms (ActiveRecord: 0.1ms)
3606
+  (0.0ms) rollback transaction
3607
+  (0.1ms) begin transaction
3608
+ -----------------------------------------------------------------------------
3609
+ Knock::AuthTokenControllerTest: test_responds_with_404_if_password_is_invalid
3610
+ -----------------------------------------------------------------------------
3611
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3612
+ Processing by Knock::AuthTokenController#create as HTML
3613
+ Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
3614
+ User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
3615
+ Completed 404 Not Found in 2ms (ActiveRecord: 0.0ms)
3616
+  (0.0ms) rollback transaction
3617
+  (0.1ms) begin transaction
3618
+ ------------------------------------------------------
3619
+ Knock::AuthTokenControllerTest: test_responds_with_201
3620
+ ------------------------------------------------------
3621
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3622
+ Processing by Knock::AuthTokenController#create as HTML
3623
+ Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
3624
+ User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
3625
+ User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
3626
+ Completed 201 Created in 2ms (Views: 0.1ms | ActiveRecord: 0.1ms)
3627
+  (0.0ms) rollback transaction
3628
+  (0.0ms) begin transaction
3629
+ ---------------------------------------
3630
+ KnockTest: test_setup_block_yields_self
3631
+ ---------------------------------------
3632
+  (0.0ms) rollback transaction
3633
+ ActiveRecord::SchemaMigration Load (0.4ms) SELECT "schema_migrations".* FROM "schema_migrations"
3634
+  (0.1ms) begin transaction
3635
+ Fixture Delete (0.6ms) DELETE FROM "users"
3636
+ Fixture Insert (0.4ms) INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('one@example.net', '$2a$04$78Z5Pym6JBqYpiexQCKW1u0kr2qFmvgH8iNTL5OgKpyWkx/EPCO7u', '2015-07-15 16:39:22', '2015-07-15 16:39:22', 980190962)
3637
+ Fixture Insert (0.1ms) INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('two@example.net', '$2a$04$0127htT2TiZ.yQNMnbXv5e7nnlwsfLpKgo.mHpQlZT4zHB3oRYnRG', '2015-07-15 16:39:22', '2015-07-15 16:39:22', 298486374)
3638
+  (0.7ms) commit transaction
3639
+  (0.0ms) begin transaction
3640
+ ------------------------------------------------------------------------------
3641
+ ProtectedResourcesControllerTest: test_has_a_current_user_after_authentication
3642
+ ------------------------------------------------------------------------------
3643
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3644
+ Processing by ProtectedResourcesController#index as HTML
3645
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3646
+ Completed 200 OK in 3ms (ActiveRecord: 0.1ms)
3647
+  (0.1ms) rollback transaction
3648
+  (0.0ms) begin transaction
3649
+ -----------------------------------------------------------------
3650
+ ProtectedResourcesControllerTest: test_responds_with_unauthorized
3651
+ -----------------------------------------------------------------
3652
+ Processing by ProtectedResourcesController#index as HTML
3653
+ Filter chain halted as :authenticate rendered or redirected
3654
+ Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
3655
+  (0.0ms) rollback transaction
3656
+  (0.0ms) begin transaction
3657
+ -----------------------------------------------------------------------------
3658
+ ProtectedResourcesControllerTest: test_responds_with_success_if_authenticated
3659
+ -----------------------------------------------------------------------------
3660
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3661
+ Processing by ProtectedResourcesController#index as HTML
3662
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3663
+ Completed 200 OK in 0ms (ActiveRecord: 0.1ms)
3664
+  (0.1ms) rollback transaction
3665
+  (0.0ms) begin transaction
3666
+ -----------------------------------------------------------------------------
3667
+ Knock::AuthTokenControllerTest: test_responds_with_404_if_user_does_not_exist
3668
+ -----------------------------------------------------------------------------
3669
+ Processing by Knock::AuthTokenController#create as HTML
3670
+ Parameters: {"auth"=>{"email"=>"wrong@example.net", "password"=>"[FILTERED]"}}
3671
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "wrong@example.net"]]
3672
+ Completed 404 Not Found in 1ms (ActiveRecord: 0.1ms)
3673
+  (0.0ms) rollback transaction
3674
+  (0.1ms) begin transaction
3675
+ -----------------------------------------------------------------------------
3676
+ Knock::AuthTokenControllerTest: test_responds_with_404_if_password_is_invalid
3677
+ -----------------------------------------------------------------------------
3678
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3679
+ Processing by Knock::AuthTokenController#create as HTML
3680
+ Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
3681
+ User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
3682
+ Completed 404 Not Found in 2ms (ActiveRecord: 0.0ms)
3683
+  (0.1ms) rollback transaction
3684
+  (0.0ms) begin transaction
3685
+ ------------------------------------------------------
3686
+ Knock::AuthTokenControllerTest: test_responds_with_201
3687
+ ------------------------------------------------------
3688
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
3689
+ Processing by Knock::AuthTokenController#create as HTML
3690
+ Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
3691
+ User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
3692
+ User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
3693
+ Completed 201 Created in 2ms (Views: 0.1ms | ActiveRecord: 0.1ms)
3694
+  (0.0ms) rollback transaction
3695
+  (0.0ms) begin transaction
3696
+ ---------------------------------------
3697
+ KnockTest: test_setup_block_yields_self
3698
+ ---------------------------------------
3699
+  (0.0ms) rollback transaction
3700
+  (0.0ms) begin transaction
3701
+ ----------------------------------------------------------------
3702
+ InstallGeneratorTest: test_Assert_all_files_are_properly_created
3703
+ ----------------------------------------------------------------
3704
+  (0.1ms) rollback transaction
@@ -0,0 +1,12 @@
1
+ require "test_helper"
2
+
3
+ class InstallGeneratorTest < Rails::Generators::TestCase
4
+ tests Knock::InstallGenerator
5
+ destination File.expand_path("../tmp", File.dirname(__FILE__))
6
+ setup :prepare_destination
7
+
8
+ test "Assert all files are properly created" do
9
+ run_generator
10
+ assert_file "config/initializers/knock.rb"
11
+ end
12
+ end
@@ -1,4 +1,9 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class KnockTest < ActiveSupport::TestCase
4
+ test 'setup block yields self' do
5
+ Knock.setup do |config|
6
+ assert_equal Knock, config
7
+ end
8
+ end
4
9
  end
@@ -0,0 +1,36 @@
1
+ Knock.setup do |config|
2
+
3
+ ## Expiration claim
4
+ ## ----------------
5
+ ##
6
+ ## How long before a token is expired.
7
+ ##
8
+ ## Default:
9
+ # config.token_lifetime = 1.day
10
+
11
+
12
+ ## Audience claim
13
+ ## --------------
14
+ ##
15
+ ## Configure the audience claim to indentify the recipients that the token
16
+ ## is intended for.
17
+ ##
18
+ ## Default:
19
+ # config.token_audience = nil
20
+
21
+ ## If using Auth0, uncomment the line below
22
+ # config.token_audience = -> { Rails.application.secrets.auth0_client_id }
23
+
24
+
25
+ ## Signature key
26
+ ## -------------
27
+ ##
28
+ ## Configure the key used to sign tokens.
29
+ ##
30
+ ## Default:
31
+ # config.token_secret_signature_key = -> { Rails.application.secrets.secret_key_base }
32
+
33
+ ## If using Auth0, uncomment the line below
34
+ # config.token_secret_signature_key = -> { Rails.application.secrets.auth0_client_secret }
35
+
36
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knock
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arnaud MESUREUR
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-07-14 00:00:00.000000000 Z
12
+ date: 2015-07-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -80,6 +80,8 @@ files:
80
80
  - app/controllers/knock/auth_token_controller.rb
81
81
  - app/model/knock/auth_token.rb
82
82
  - config/routes.rb
83
+ - lib/generators/knock/install_generator.rb
84
+ - lib/generators/templates/knock.rb
83
85
  - lib/knock.rb
84
86
  - lib/knock/authenticable.rb
85
87
  - lib/knock/engine.rb
@@ -121,6 +123,7 @@ files:
121
123
  - test/dummy/db/migrate/20150713101607_create_users.rb
122
124
  - test/dummy/db/schema.rb
123
125
  - test/dummy/db/test.sqlite3
126
+ - test/dummy/log/development.log
124
127
  - test/dummy/log/test.log
125
128
  - test/dummy/public/404.html
126
129
  - test/dummy/public/422.html
@@ -130,8 +133,10 @@ files:
130
133
  - test/dummy/test/fixtures/users.yml
131
134
  - test/dummy/test/models/user_test.rb
132
135
  - test/fixtures/users.yml
136
+ - test/generators/install_generator_test.rb
133
137
  - test/knock_test.rb
134
138
  - test/test_helper.rb
139
+ - test/tmp/config/initializers/knock.rb
135
140
  homepage: https://github.com/nsarno/knock
136
141
  licenses:
137
142
  - MIT
@@ -147,9 +152,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
147
152
  version: '0'
148
153
  required_rubygems_version: !ruby/object:Gem::Requirement
149
154
  requirements:
150
- - - ">="
155
+ - - ">"
151
156
  - !ruby/object:Gem::Version
152
- version: '0'
157
+ version: 1.3.1
153
158
  requirements: []
154
159
  rubyforge_project:
155
160
  rubygems_version: 2.4.4
@@ -191,6 +196,7 @@ test_files:
191
196
  - test/dummy/db/migrate/20150713101607_create_users.rb
192
197
  - test/dummy/db/schema.rb
193
198
  - test/dummy/db/test.sqlite3
199
+ - test/dummy/log/development.log
194
200
  - test/dummy/log/test.log
195
201
  - test/dummy/public/404.html
196
202
  - test/dummy/public/422.html
@@ -202,5 +208,7 @@ test_files:
202
208
  - test/dummy/test/fixtures/users.yml
203
209
  - test/dummy/test/models/user_test.rb
204
210
  - test/fixtures/users.yml
211
+ - test/generators/install_generator_test.rb
205
212
  - test/knock_test.rb
206
213
  - test/test_helper.rb
214
+ - test/tmp/config/initializers/knock.rb