knock 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/knock/auth_token_controller.rb +1 -1
- data/lib/generators/templates/knock.rb +12 -1
- data/lib/knock.rb +3 -0
- data/lib/knock/authenticable.rb +1 -1
- data/lib/knock/version.rb +1 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +576 -0
- data/test/dummy/test/controllers/protected_resources_controller_test.rb +1 -1
- data/test/tmp/config/initializers/knock.rb +12 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3966295873b5de911304239f5bd841144a88333
|
4
|
+
data.tar.gz: 4a88b9f1efbf8b6919e29b17ea331824b51c44c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be761b6599228ae01ec6533eb8f7f99b79dab91d6b69b62bc2be54839cbdd9392773be7ee8c673e0c076802ad83fa70e4081c24d8ecfa9d5c5a585a2fbec9db8
|
7
|
+
data.tar.gz: 5e0a0d1b1edc8071935ac6f99fbf4dcda8d91e2a859278fc704070b307840bb42453b1f3aa8b123ee9db02f7884edc15f96ebd799aff37f1900c5da411253e25
|
@@ -1,5 +1,16 @@
|
|
1
1
|
Knock.setup do |config|
|
2
2
|
|
3
|
+
## Current user retrieval when validating token
|
4
|
+
## --------------------------------------------
|
5
|
+
##
|
6
|
+
## This is how you can tell Knock how to retrieve the current_user.
|
7
|
+
## By default, it assumes you have a model called `User` and that
|
8
|
+
## the user_id is stored in the 'sub' claim.
|
9
|
+
##
|
10
|
+
## Default:
|
11
|
+
# config.current_user_from_token = -> (claims) { User.find claims['sub'] }
|
12
|
+
|
13
|
+
|
3
14
|
## Expiration claim
|
4
15
|
## ----------------
|
5
16
|
##
|
@@ -31,6 +42,6 @@ Knock.setup do |config|
|
|
31
42
|
# config.token_secret_signature_key = -> { Rails.application.secrets.secret_key_base }
|
32
43
|
|
33
44
|
## If using Auth0, uncomment the line below
|
34
|
-
# config.token_secret_signature_key = -> { Rails.application.secrets.auth0_client_secret }
|
45
|
+
# config.token_secret_signature_key = -> { JWT.base64url_decode Rails.application.secrets.auth0_client_secret }
|
35
46
|
|
36
47
|
end
|
data/lib/knock.rb
CHANGED
@@ -11,6 +11,9 @@ module Knock
|
|
11
11
|
mattr_accessor :token_secret_signature_key
|
12
12
|
self.token_secret_signature_key = -> { Rails.application.secrets.secret_key_base }
|
13
13
|
|
14
|
+
mattr_accessor :current_user_from_token
|
15
|
+
self.current_user_from_token = -> (claims) { User.find claims['sub'] }
|
16
|
+
|
14
17
|
# Default way to setup Knock. Run rails generate knock_install to create
|
15
18
|
# a fresh initializer with all configuration values.
|
16
19
|
def self.setup
|
data/lib/knock/authenticable.rb
CHANGED
@@ -5,7 +5,7 @@ module Knock::Authenticable
|
|
5
5
|
begin
|
6
6
|
token = request.headers['Authorization'].split(' ').last
|
7
7
|
payload, header = Knock::AuthToken.new(token: token).validate!
|
8
|
-
@current_user =
|
8
|
+
@current_user = Knock.current_user_from_token.call(payload)
|
9
9
|
rescue
|
10
10
|
head :unauthorized
|
11
11
|
end
|
data/lib/knock/version.rb
CHANGED
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
data/test/dummy/log/test.log
CHANGED
@@ -3846,3 +3846,579 @@ Processing by Knock::AuthTokenController#create as HTML
|
|
3846
3846
|
[1m[36mUser Load (0.0ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1[0m [["email", "one@example.net"]]
|
3847
3847
|
Completed 201 Created in 3ms (Views: 0.2ms | ActiveRecord: 0.1ms)
|
3848
3848
|
[1m[35m (0.1ms)[0m rollback transaction
|
3849
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.4ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
3850
|
+
[1m[35m (0.1ms)[0m begin transaction
|
3851
|
+
[1m[36mFixture Delete (0.8ms)[0m [1mDELETE FROM "users"[0m
|
3852
|
+
[1m[35mFixture Insert (0.5ms)[0m INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('one@example.net', '$2a$04$XIklu6b1fu1FKZ40/zthquwZtWD1iOVDxOHSKXMCiXQTmv9tdE1k2', '2015-07-16 09:38:29', '2015-07-16 09:38:29', 980190962)
|
3853
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('two@example.net', '$2a$04$HmSbuUSOgrKFCMcSG3bHgOBOqNlaEOGaLodG3bkgYK7vae.DCe81y', '2015-07-16 09:38:29', '2015-07-16 09:38:29', 298486374)[0m
|
3854
|
+
[1m[35m (0.8ms)[0m commit transaction
|
3855
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
3856
|
+
-----------------------------------------------------------------------------
|
3857
|
+
Knock::AuthTokenControllerTest: test_responds_with_404_if_password_is_invalid
|
3858
|
+
-----------------------------------------------------------------------------
|
3859
|
+
[1m[35mUser Load (0.2ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
3860
|
+
Processing by Knock::AuthTokenController#create as HTML
|
3861
|
+
Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
|
3862
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."email" IS NULL LIMIT 1[0m
|
3863
|
+
Completed 404 Not Found in 1ms (ActiveRecord: 0.1ms)
|
3864
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
3865
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
3866
|
+
------------------------------------------------------
|
3867
|
+
Knock::AuthTokenControllerTest: test_responds_with_201
|
3868
|
+
------------------------------------------------------
|
3869
|
+
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
3870
|
+
Processing by Knock::AuthTokenController#create as HTML
|
3871
|
+
Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
|
3872
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."email" IS NULL LIMIT 1[0m
|
3873
|
+
Completed 404 Not Found in 0ms (ActiveRecord: 0.1ms)
|
3874
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
3875
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
3876
|
+
-----------------------------------------------------------------------------
|
3877
|
+
Knock::AuthTokenControllerTest: test_responds_with_404_if_user_does_not_exist
|
3878
|
+
-----------------------------------------------------------------------------
|
3879
|
+
Processing by Knock::AuthTokenController#create as HTML
|
3880
|
+
Parameters: {"auth"=>{"email"=>"wrong@example.net", "password"=>"[FILTERED]"}}
|
3881
|
+
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."email" IS NULL LIMIT 1
|
3882
|
+
Completed 404 Not Found in 0ms (ActiveRecord: 0.1ms)
|
3883
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
3884
|
+
[1m[35m (0.0ms)[0m begin transaction
|
3885
|
+
----------------------------------------------------------------
|
3886
|
+
InstallGeneratorTest: test_Assert_all_files_are_properly_created
|
3887
|
+
----------------------------------------------------------------
|
3888
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
3889
|
+
[1m[35m (0.0ms)[0m begin transaction
|
3890
|
+
-----------------------------------------------------------------
|
3891
|
+
ProtectedResourcesControllerTest: test_responds_with_unauthorized
|
3892
|
+
-----------------------------------------------------------------
|
3893
|
+
Processing by ProtectedResourcesController#index as HTML
|
3894
|
+
Filter chain halted as :authenticate rendered or redirected
|
3895
|
+
Completed 401 Unauthorized in 1ms (ActiveRecord: 0.0ms)
|
3896
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
3897
|
+
[1m[35m (0.0ms)[0m begin transaction
|
3898
|
+
-----------------------------------------------------------------------------
|
3899
|
+
ProtectedResourcesControllerTest: test_responds_with_success_if_authenticated
|
3900
|
+
-----------------------------------------------------------------------------
|
3901
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
3902
|
+
Processing by ProtectedResourcesController#index as HTML
|
3903
|
+
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", nil]]
|
3904
|
+
Filter chain halted as :authenticate rendered or redirected
|
3905
|
+
Completed 401 Unauthorized in 2ms (ActiveRecord: 0.1ms)
|
3906
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
3907
|
+
[1m[35m (0.1ms)[0m begin transaction
|
3908
|
+
------------------------------------------------------------------------------
|
3909
|
+
ProtectedResourcesControllerTest: test_has_a_current_user_after_authentication
|
3910
|
+
------------------------------------------------------------------------------
|
3911
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
3912
|
+
Processing by ProtectedResourcesController#index as HTML
|
3913
|
+
[1m[35mUser Load (0.0ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", nil]]
|
3914
|
+
Filter chain halted as :authenticate rendered or redirected
|
3915
|
+
Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
|
3916
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
3917
|
+
[1m[35m (0.0ms)[0m begin transaction
|
3918
|
+
---------------------------------------
|
3919
|
+
KnockTest: test_setup_block_yields_self
|
3920
|
+
---------------------------------------
|
3921
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
3922
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
3923
|
+
[1m[35m (0.1ms)[0m begin transaction
|
3924
|
+
[1m[36mFixture Delete (0.2ms)[0m [1mDELETE FROM "users"[0m
|
3925
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('one@example.net', '$2a$04$.sMdp6yE/Zt4bywOmkjEyeR/M9ZMkTAQCLYSvbdgyAZEDwYVhq8oS', '2015-07-16 09:44:11', '2015-07-16 09:44:11', 980190962)
|
3926
|
+
[1m[36mFixture Insert (0.0ms)[0m [1mINSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('two@example.net', '$2a$04$8dRtTY5vUsVbAdOk5FYkU.Jn37Li2HVIH8xhowD1QY7Mu.6zU2teG', '2015-07-16 09:44:11', '2015-07-16 09:44:11', 298486374)[0m
|
3927
|
+
[1m[35m (0.8ms)[0m commit transaction
|
3928
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
3929
|
+
-----------------------------------------------------------------------------
|
3930
|
+
Knock::AuthTokenControllerTest: test_responds_with_404_if_password_is_invalid
|
3931
|
+
-----------------------------------------------------------------------------
|
3932
|
+
[1m[35mUser Load (0.2ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
3933
|
+
Processing by Knock::AuthTokenController#create as HTML
|
3934
|
+
Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
|
3935
|
+
[1m[36mUser Load (0.3ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."email" IS NULL LIMIT 1[0m
|
3936
|
+
Completed 404 Not Found in 1ms (ActiveRecord: 0.3ms)
|
3937
|
+
[1m[35m (0.2ms)[0m rollback transaction
|
3938
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
3939
|
+
-----------------------------------------------------------------------------
|
3940
|
+
Knock::AuthTokenControllerTest: test_responds_with_404_if_user_does_not_exist
|
3941
|
+
-----------------------------------------------------------------------------
|
3942
|
+
Processing by Knock::AuthTokenController#create as HTML
|
3943
|
+
Parameters: {"auth"=>{"email"=>"wrong@example.net", "password"=>"[FILTERED]"}}
|
3944
|
+
[1m[35mUser Load (0.2ms)[0m SELECT "users".* FROM "users" WHERE "users"."email" IS NULL LIMIT 1
|
3945
|
+
Completed 404 Not Found in 1ms (ActiveRecord: 0.2ms)
|
3946
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
3947
|
+
[1m[35m (0.1ms)[0m begin transaction
|
3948
|
+
------------------------------------------------------
|
3949
|
+
Knock::AuthTokenControllerTest: test_responds_with_201
|
3950
|
+
------------------------------------------------------
|
3951
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
3952
|
+
Processing by Knock::AuthTokenController#create as HTML
|
3953
|
+
Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
|
3954
|
+
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."email" IS NULL LIMIT 1
|
3955
|
+
Completed 404 Not Found in 0ms (ActiveRecord: 0.1ms)
|
3956
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
3957
|
+
[1m[35m (0.0ms)[0m begin transaction
|
3958
|
+
-----------------------------------------------------------------
|
3959
|
+
ProtectedResourcesControllerTest: test_responds_with_unauthorized
|
3960
|
+
-----------------------------------------------------------------
|
3961
|
+
Processing by ProtectedResourcesController#index as HTML
|
3962
|
+
Filter chain halted as :authenticate rendered or redirected
|
3963
|
+
Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
|
3964
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
3965
|
+
[1m[35m (0.0ms)[0m begin transaction
|
3966
|
+
-----------------------------------------------------------------------------
|
3967
|
+
ProtectedResourcesControllerTest: test_responds_with_success_if_authenticated
|
3968
|
+
-----------------------------------------------------------------------------
|
3969
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
3970
|
+
Processing by ProtectedResourcesController#index as HTML
|
3971
|
+
[1m[35mUser Load (0.0ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", nil]]
|
3972
|
+
Filter chain halted as :authenticate rendered or redirected
|
3973
|
+
Completed 401 Unauthorized in 2ms (ActiveRecord: 0.0ms)
|
3974
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
3975
|
+
[1m[35m (0.1ms)[0m begin transaction
|
3976
|
+
------------------------------------------------------------------------------
|
3977
|
+
ProtectedResourcesControllerTest: test_has_a_current_user_after_authentication
|
3978
|
+
------------------------------------------------------------------------------
|
3979
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
3980
|
+
Processing by ProtectedResourcesController#index as HTML
|
3981
|
+
[1m[35mUser Load (0.0ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", nil]]
|
3982
|
+
Filter chain halted as :authenticate rendered or redirected
|
3983
|
+
Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
|
3984
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
3985
|
+
[1m[35m (0.0ms)[0m begin transaction
|
3986
|
+
----------------------------------------------------------------
|
3987
|
+
InstallGeneratorTest: test_Assert_all_files_are_properly_created
|
3988
|
+
----------------------------------------------------------------
|
3989
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
3990
|
+
[1m[35m (0.1ms)[0m begin transaction
|
3991
|
+
---------------------------------------
|
3992
|
+
KnockTest: test_setup_block_yields_self
|
3993
|
+
---------------------------------------
|
3994
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
3995
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
3996
|
+
[1m[35m (0.1ms)[0m begin transaction
|
3997
|
+
[1m[36mFixture Delete (0.2ms)[0m [1mDELETE FROM "users"[0m
|
3998
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('one@example.net', '$2a$04$08oFJCfJGV4ze1vKJRYbAOKcHdp/oH6IVeF4YcX44cs2TVvYmJcgK', '2015-07-16 09:56:24', '2015-07-16 09:56:24', 980190962)
|
3999
|
+
[1m[36mFixture Insert (0.0ms)[0m [1mINSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('two@example.net', '$2a$04$ugtejufJzCgRRVlNVR.fq.MQeJ8dykhBw0wOxWc1IrC021SJHSfPq', '2015-07-16 09:56:24', '2015-07-16 09:56:24', 298486374)[0m
|
4000
|
+
[1m[35m (1.1ms)[0m commit transaction
|
4001
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
4002
|
+
------------------------------------------------------------------------------
|
4003
|
+
ProtectedResourcesControllerTest: test_has_a_current_user_after_authentication
|
4004
|
+
------------------------------------------------------------------------------
|
4005
|
+
[1m[35mUser Load (0.2ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
4006
|
+
Processing by ProtectedResourcesController#index as HTML
|
4007
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", nil]]
|
4008
|
+
Filter chain halted as :authenticate rendered or redirected
|
4009
|
+
Completed 401 Unauthorized in 2ms (ActiveRecord: 0.1ms)
|
4010
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
4011
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
4012
|
+
-----------------------------------------------------------------------------
|
4013
|
+
ProtectedResourcesControllerTest: test_responds_with_success_if_authenticated
|
4014
|
+
-----------------------------------------------------------------------------
|
4015
|
+
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
4016
|
+
Processing by ProtectedResourcesController#index as HTML
|
4017
|
+
[1m[36mUser Load (0.0ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", nil]]
|
4018
|
+
Filter chain halted as :authenticate rendered or redirected
|
4019
|
+
Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
|
4020
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
4021
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
4022
|
+
-----------------------------------------------------------------
|
4023
|
+
ProtectedResourcesControllerTest: test_responds_with_unauthorized
|
4024
|
+
-----------------------------------------------------------------
|
4025
|
+
Processing by ProtectedResourcesController#index as HTML
|
4026
|
+
Filter chain halted as :authenticate rendered or redirected
|
4027
|
+
Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
|
4028
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
4029
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
4030
|
+
---------------------------------------
|
4031
|
+
KnockTest: test_setup_block_yields_self
|
4032
|
+
---------------------------------------
|
4033
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
4034
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
4035
|
+
------------------------------------------------------
|
4036
|
+
Knock::AuthTokenControllerTest: test_responds_with_201
|
4037
|
+
------------------------------------------------------
|
4038
|
+
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
4039
|
+
Processing by Knock::AuthTokenController#create as HTML
|
4040
|
+
Parameters: {"email"=>"one@example.net", "password"=>"[FILTERED]"}
|
4041
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1[0m [["email", "one@example.net"]]
|
4042
|
+
[1m[35mUser Load (0.0ms)[0m SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
|
4043
|
+
Completed 201 Created in 2ms (Views: 0.1ms | ActiveRecord: 0.1ms)
|
4044
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
4045
|
+
[1m[35m (0.0ms)[0m begin transaction
|
4046
|
+
-----------------------------------------------------------------------------
|
4047
|
+
Knock::AuthTokenControllerTest: test_responds_with_404_if_password_is_invalid
|
4048
|
+
-----------------------------------------------------------------------------
|
4049
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
4050
|
+
Processing by Knock::AuthTokenController#create as HTML
|
4051
|
+
Parameters: {"email"=>"one@example.net", "password"=>"[FILTERED]"}
|
4052
|
+
[1m[35mUser Load (0.0ms)[0m SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
|
4053
|
+
Completed 404 Not Found in 1ms (ActiveRecord: 0.0ms)
|
4054
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
4055
|
+
[1m[35m (0.1ms)[0m begin transaction
|
4056
|
+
-----------------------------------------------------------------------------
|
4057
|
+
Knock::AuthTokenControllerTest: test_responds_with_404_if_user_does_not_exist
|
4058
|
+
-----------------------------------------------------------------------------
|
4059
|
+
Processing by Knock::AuthTokenController#create as HTML
|
4060
|
+
Parameters: {"email"=>"wrong@example.net", "password"=>"[FILTERED]"}
|
4061
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1[0m [["email", "wrong@example.net"]]
|
4062
|
+
Completed 404 Not Found in 0ms (ActiveRecord: 0.1ms)
|
4063
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
4064
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
4065
|
+
----------------------------------------------------------------
|
4066
|
+
InstallGeneratorTest: test_Assert_all_files_are_properly_created
|
4067
|
+
----------------------------------------------------------------
|
4068
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
4069
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
4070
|
+
[1m[35m (0.1ms)[0m begin transaction
|
4071
|
+
[1m[36mFixture Delete (0.2ms)[0m [1mDELETE FROM "users"[0m
|
4072
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('one@example.net', '$2a$04$mGECCWvf2.VjIDBcfKh7MOg4UyxtY5Q./myTBhaYkh.S77ZuY8z.O', '2015-07-16 09:57:12', '2015-07-16 09:57:12', 980190962)
|
4073
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('two@example.net', '$2a$04$GET9U7cpvZqQmrWl4lSdee6IW6zvMICcVi.zojH4rZTXE8Mao/EHi', '2015-07-16 09:57:12', '2015-07-16 09:57:12', 298486374)[0m
|
4074
|
+
[1m[35m (1.4ms)[0m commit transaction
|
4075
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
4076
|
+
------------------------------------------------------
|
4077
|
+
Knock::AuthTokenControllerTest: test_responds_with_201
|
4078
|
+
------------------------------------------------------
|
4079
|
+
[1m[35mUser Load (0.2ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
4080
|
+
Processing by Knock::AuthTokenController#create as HTML
|
4081
|
+
Parameters: {"email"=>"one@example.net", "password"=>"[FILTERED]"}
|
4082
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1[0m [["email", "one@example.net"]]
|
4083
|
+
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
|
4084
|
+
Completed 201 Created in 17ms (Views: 0.2ms | ActiveRecord: 0.2ms)
|
4085
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
4086
|
+
[1m[35m (0.1ms)[0m begin transaction
|
4087
|
+
-----------------------------------------------------------------------------
|
4088
|
+
Knock::AuthTokenControllerTest: test_responds_with_404_if_user_does_not_exist
|
4089
|
+
-----------------------------------------------------------------------------
|
4090
|
+
Processing by Knock::AuthTokenController#create as HTML
|
4091
|
+
Parameters: {"email"=>"wrong@example.net", "password"=>"[FILTERED]"}
|
4092
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1[0m [["email", "wrong@example.net"]]
|
4093
|
+
Completed 404 Not Found in 0ms (ActiveRecord: 0.1ms)
|
4094
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
4095
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
4096
|
+
-----------------------------------------------------------------------------
|
4097
|
+
Knock::AuthTokenControllerTest: test_responds_with_404_if_password_is_invalid
|
4098
|
+
-----------------------------------------------------------------------------
|
4099
|
+
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
4100
|
+
Processing by Knock::AuthTokenController#create as HTML
|
4101
|
+
Parameters: {"email"=>"one@example.net", "password"=>"[FILTERED]"}
|
4102
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1[0m [["email", "one@example.net"]]
|
4103
|
+
Completed 404 Not Found in 2ms (ActiveRecord: 0.1ms)
|
4104
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
4105
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
4106
|
+
----------------------------------------------------------------
|
4107
|
+
InstallGeneratorTest: test_Assert_all_files_are_properly_created
|
4108
|
+
----------------------------------------------------------------
|
4109
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
4110
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
4111
|
+
-----------------------------------------------------------------------------
|
4112
|
+
ProtectedResourcesControllerTest: test_responds_with_success_if_authenticated
|
4113
|
+
-----------------------------------------------------------------------------
|
4114
|
+
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
4115
|
+
Processing by ProtectedResourcesController#index as HTML
|
4116
|
+
[1m[36mUser Load (0.0ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
4117
|
+
Completed 200 OK in 1ms (ActiveRecord: 0.0ms)
|
4118
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
4119
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
4120
|
+
------------------------------------------------------------------------------
|
4121
|
+
ProtectedResourcesControllerTest: test_has_a_current_user_after_authentication
|
4122
|
+
------------------------------------------------------------------------------
|
4123
|
+
[1m[35mUser Load (0.2ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
4124
|
+
Processing by ProtectedResourcesController#index as HTML
|
4125
|
+
[1m[36mUser Load (0.0ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
4126
|
+
Completed 200 OK in 0ms (ActiveRecord: 0.0ms)
|
4127
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
4128
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
4129
|
+
-----------------------------------------------------------------
|
4130
|
+
ProtectedResourcesControllerTest: test_responds_with_unauthorized
|
4131
|
+
-----------------------------------------------------------------
|
4132
|
+
Processing by ProtectedResourcesController#index as HTML
|
4133
|
+
Filter chain halted as :authenticate rendered or redirected
|
4134
|
+
Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
|
4135
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
4136
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
4137
|
+
---------------------------------------
|
4138
|
+
KnockTest: test_setup_block_yields_self
|
4139
|
+
---------------------------------------
|
4140
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
4141
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
4142
|
+
[1m[35m (0.1ms)[0m begin transaction
|
4143
|
+
[1m[36mFixture Delete (0.3ms)[0m [1mDELETE FROM "users"[0m
|
4144
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('one@example.net', '$2a$04$PYLUT1UhR5lwzT8P22ef8Ojnb4AHZNzaAD67NQP1xsPHG8UzmslnO', '2015-07-16 10:23:58', '2015-07-16 10:23:58', 980190962)
|
4145
|
+
[1m[36mFixture Insert (0.0ms)[0m [1mINSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('two@example.net', '$2a$04$eXOZCzcgj5DbFV/K0OIDhu.BQQbx2cVS7krRqQJsxnfRJSHhUJCAC', '2015-07-16 10:23:58', '2015-07-16 10:23:58', 298486374)[0m
|
4146
|
+
[1m[35m (0.7ms)[0m commit transaction
|
4147
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
4148
|
+
------------------------------------------------------------------------------
|
4149
|
+
ProtectedResourcesControllerTest: test_has_a_current_user_after_authentication
|
4150
|
+
------------------------------------------------------------------------------
|
4151
|
+
[1m[35mUser Load (0.2ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
4152
|
+
Processing by ProtectedResourcesController#index as HTML
|
4153
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
4154
|
+
Completed 200 OK in 2ms (ActiveRecord: 0.1ms)
|
4155
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
4156
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
4157
|
+
-----------------------------------------------------------------------------
|
4158
|
+
ProtectedResourcesControllerTest: test_responds_with_success_if_authenticated
|
4159
|
+
-----------------------------------------------------------------------------
|
4160
|
+
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
4161
|
+
Processing by ProtectedResourcesController#index as HTML
|
4162
|
+
[1m[36mUser Load (0.0ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
4163
|
+
Completed 200 OK in 0ms (ActiveRecord: 0.0ms)
|
4164
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
4165
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
4166
|
+
-----------------------------------------------------------------
|
4167
|
+
ProtectedResourcesControllerTest: test_responds_with_unauthorized
|
4168
|
+
-----------------------------------------------------------------
|
4169
|
+
Processing by ProtectedResourcesController#index as HTML
|
4170
|
+
Filter chain halted as :authenticate rendered or redirected
|
4171
|
+
Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
|
4172
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
4173
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
4174
|
+
------------------------------------------------------
|
4175
|
+
Knock::AuthTokenControllerTest: test_responds_with_201
|
4176
|
+
------------------------------------------------------
|
4177
|
+
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
4178
|
+
Processing by Knock::AuthTokenController#create as HTML
|
4179
|
+
Parameters: {"email"=>"one@example.net", "password"=>"[FILTERED]"}
|
4180
|
+
Completed 400 Bad Request in 0ms (ActiveRecord: 0.0ms)
|
4181
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
4182
|
+
[1m[35m (0.0ms)[0m begin transaction
|
4183
|
+
-----------------------------------------------------------------------------
|
4184
|
+
Knock::AuthTokenControllerTest: test_responds_with_404_if_user_does_not_exist
|
4185
|
+
-----------------------------------------------------------------------------
|
4186
|
+
Processing by Knock::AuthTokenController#create as HTML
|
4187
|
+
Parameters: {"email"=>"wrong@example.net", "password"=>"[FILTERED]"}
|
4188
|
+
Completed 400 Bad Request in 0ms (ActiveRecord: 0.0ms)
|
4189
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
4190
|
+
[1m[35m (0.0ms)[0m begin transaction
|
4191
|
+
-----------------------------------------------------------------------------
|
4192
|
+
Knock::AuthTokenControllerTest: test_responds_with_404_if_password_is_invalid
|
4193
|
+
-----------------------------------------------------------------------------
|
4194
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
4195
|
+
Processing by Knock::AuthTokenController#create as HTML
|
4196
|
+
Parameters: {"email"=>"one@example.net", "password"=>"[FILTERED]"}
|
4197
|
+
Completed 400 Bad Request in 0ms (ActiveRecord: 0.0ms)
|
4198
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
4199
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
4200
|
+
----------------------------------------------------------------
|
4201
|
+
InstallGeneratorTest: test_Assert_all_files_are_properly_created
|
4202
|
+
----------------------------------------------------------------
|
4203
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
4204
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
4205
|
+
---------------------------------------
|
4206
|
+
KnockTest: test_setup_block_yields_self
|
4207
|
+
---------------------------------------
|
4208
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
4209
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
4210
|
+
[1m[35m (0.1ms)[0m begin transaction
|
4211
|
+
[1m[36mFixture Delete (0.3ms)[0m [1mDELETE FROM "users"[0m
|
4212
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('one@example.net', '$2a$04$fj8sa6plfdreIFtTWP60Vud08hkBuX9pHRKlei2z72X20aEol3v0O', '2015-07-16 10:24:41', '2015-07-16 10:24:41', 980190962)
|
4213
|
+
[1m[36mFixture Insert (0.0ms)[0m [1mINSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('two@example.net', '$2a$04$ql5fbaUCydiFeL/KoZfe3OS9EJTK6e16PHuuxTnIfzPxQZYjj95xK', '2015-07-16 10:24:41', '2015-07-16 10:24:41', 298486374)[0m
|
4214
|
+
[1m[35m (1.5ms)[0m commit transaction
|
4215
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
4216
|
+
---------------------------------------
|
4217
|
+
KnockTest: test_setup_block_yields_self
|
4218
|
+
---------------------------------------
|
4219
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
4220
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
4221
|
+
----------------------------------------------------------------
|
4222
|
+
InstallGeneratorTest: test_Assert_all_files_are_properly_created
|
4223
|
+
----------------------------------------------------------------
|
4224
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
4225
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
4226
|
+
-----------------------------------------------------------------------------
|
4227
|
+
Knock::AuthTokenControllerTest: test_responds_with_404_if_user_does_not_exist
|
4228
|
+
-----------------------------------------------------------------------------
|
4229
|
+
Processing by Knock::AuthTokenController#create as HTML
|
4230
|
+
Parameters: {"auth"=>{"email"=>"wrong@example.net", "password"=>"[FILTERED]"}}
|
4231
|
+
[1m[35mUser Load (0.2ms)[0m SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "wrong@example.net"]]
|
4232
|
+
Completed 404 Not Found in 11ms (ActiveRecord: 0.2ms)
|
4233
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
4234
|
+
[1m[35m (0.1ms)[0m begin transaction
|
4235
|
+
-----------------------------------------------------------------------------
|
4236
|
+
Knock::AuthTokenControllerTest: test_responds_with_404_if_password_is_invalid
|
4237
|
+
-----------------------------------------------------------------------------
|
4238
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
4239
|
+
Processing by Knock::AuthTokenController#create as HTML
|
4240
|
+
Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
|
4241
|
+
[1m[35mUser Load (0.0ms)[0m SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
|
4242
|
+
Completed 404 Not Found in 2ms (ActiveRecord: 0.0ms)
|
4243
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
4244
|
+
[1m[35m (0.1ms)[0m begin transaction
|
4245
|
+
------------------------------------------------------
|
4246
|
+
Knock::AuthTokenControllerTest: test_responds_with_201
|
4247
|
+
------------------------------------------------------
|
4248
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
4249
|
+
Processing by Knock::AuthTokenController#create as HTML
|
4250
|
+
Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
|
4251
|
+
[1m[35mUser Load (0.0ms)[0m SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
|
4252
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1[0m [["email", "one@example.net"]]
|
4253
|
+
Completed 201 Created in 7ms (Views: 0.1ms | ActiveRecord: 0.1ms)
|
4254
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
4255
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
4256
|
+
-----------------------------------------------------------------
|
4257
|
+
ProtectedResourcesControllerTest: test_responds_with_unauthorized
|
4258
|
+
-----------------------------------------------------------------
|
4259
|
+
Processing by ProtectedResourcesController#index as HTML
|
4260
|
+
Filter chain halted as :authenticate rendered or redirected
|
4261
|
+
Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
|
4262
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
4263
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
4264
|
+
-----------------------------------------------------------------------------
|
4265
|
+
ProtectedResourcesControllerTest: test_responds_with_success_if_authenticated
|
4266
|
+
-----------------------------------------------------------------------------
|
4267
|
+
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
4268
|
+
Processing by ProtectedResourcesController#index as HTML
|
4269
|
+
[1m[36mUser Load (0.0ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
4270
|
+
Completed 200 OK in 1ms (ActiveRecord: 0.0ms)
|
4271
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
4272
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
4273
|
+
------------------------------------------------------------------------------
|
4274
|
+
ProtectedResourcesControllerTest: test_has_a_current_user_after_authentication
|
4275
|
+
------------------------------------------------------------------------------
|
4276
|
+
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
4277
|
+
Processing by ProtectedResourcesController#index as HTML
|
4278
|
+
[1m[36mUser Load (0.0ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
4279
|
+
Completed 200 OK in 0ms (ActiveRecord: 0.0ms)
|
4280
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
4281
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
4282
|
+
[1m[35m (0.1ms)[0m begin transaction
|
4283
|
+
[1m[36mFixture Delete (0.2ms)[0m [1mDELETE FROM "users"[0m
|
4284
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('one@example.net', '$2a$04$orGP2.6Hy7ckBDOemlIv2ejeS3MPla.ULVHFqJOiPWRB6dz6x5DHK', '2015-07-16 10:26:51', '2015-07-16 10:26:51', 980190962)
|
4285
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('two@example.net', '$2a$04$oYsWRTGRx4sfJIGsruqNM.eTjI0ZzjufLbKkjD4YkJJh26j7WhUCG', '2015-07-16 10:26:51', '2015-07-16 10:26:51', 298486374)[0m
|
4286
|
+
[1m[35m (1.5ms)[0m commit transaction
|
4287
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
4288
|
+
---------------------------------------
|
4289
|
+
KnockTest: test_setup_block_yields_self
|
4290
|
+
---------------------------------------
|
4291
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
4292
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
4293
|
+
-----------------------------------------------------------------------------
|
4294
|
+
Knock::AuthTokenControllerTest: test_responds_with_404_if_password_is_invalid
|
4295
|
+
-----------------------------------------------------------------------------
|
4296
|
+
[1m[35mUser Load (0.2ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
4297
|
+
Processing by Knock::AuthTokenController#create as HTML
|
4298
|
+
Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
|
4299
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1[0m [["email", "one@example.net"]]
|
4300
|
+
Completed 404 Not Found in 11ms (ActiveRecord: 0.1ms)
|
4301
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
4302
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
4303
|
+
------------------------------------------------------
|
4304
|
+
Knock::AuthTokenControllerTest: test_responds_with_201
|
4305
|
+
------------------------------------------------------
|
4306
|
+
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
4307
|
+
Processing by Knock::AuthTokenController#create as HTML
|
4308
|
+
Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
|
4309
|
+
[1m[36mUser Load (0.0ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1[0m [["email", "one@example.net"]]
|
4310
|
+
[1m[35mUser Load (0.0ms)[0m SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
|
4311
|
+
Completed 201 Created in 7ms (Views: 0.2ms | ActiveRecord: 0.1ms)
|
4312
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
4313
|
+
[1m[35m (0.1ms)[0m begin transaction
|
4314
|
+
-----------------------------------------------------------------------------
|
4315
|
+
Knock::AuthTokenControllerTest: test_responds_with_404_if_user_does_not_exist
|
4316
|
+
-----------------------------------------------------------------------------
|
4317
|
+
Processing by Knock::AuthTokenController#create as HTML
|
4318
|
+
Parameters: {"auth"=>{"email"=>"wrong@example.net", "password"=>"[FILTERED]"}}
|
4319
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1[0m [["email", "wrong@example.net"]]
|
4320
|
+
Completed 404 Not Found in 0ms (ActiveRecord: 0.1ms)
|
4321
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
4322
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
4323
|
+
----------------------------------------------------------------
|
4324
|
+
InstallGeneratorTest: test_Assert_all_files_are_properly_created
|
4325
|
+
----------------------------------------------------------------
|
4326
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
4327
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
4328
|
+
-----------------------------------------------------------------
|
4329
|
+
ProtectedResourcesControllerTest: test_responds_with_unauthorized
|
4330
|
+
-----------------------------------------------------------------
|
4331
|
+
Processing by ProtectedResourcesController#index as HTML
|
4332
|
+
Filter chain halted as :authenticate rendered or redirected
|
4333
|
+
Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
|
4334
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
4335
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
4336
|
+
-----------------------------------------------------------------------------
|
4337
|
+
ProtectedResourcesControllerTest: test_responds_with_success_if_authenticated
|
4338
|
+
-----------------------------------------------------------------------------
|
4339
|
+
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
4340
|
+
Processing by ProtectedResourcesController#index as HTML
|
4341
|
+
[1m[36mUser Load (0.0ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
4342
|
+
Completed 200 OK in 1ms (ActiveRecord: 0.0ms)
|
4343
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
4344
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
4345
|
+
------------------------------------------------------------------------------
|
4346
|
+
ProtectedResourcesControllerTest: test_has_a_current_user_after_authentication
|
4347
|
+
------------------------------------------------------------------------------
|
4348
|
+
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
4349
|
+
Processing by ProtectedResourcesController#index as HTML
|
4350
|
+
[1m[36mUser Load (0.0ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
4351
|
+
Completed 200 OK in 0ms (ActiveRecord: 0.0ms)
|
4352
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
4353
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
4354
|
+
[1m[35m (0.1ms)[0m begin transaction
|
4355
|
+
[1m[36mFixture Delete (0.3ms)[0m [1mDELETE FROM "users"[0m
|
4356
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('one@example.net', '$2a$04$YvWXmr54tipdqITMnPZ80eLyBpR3RCJClbMMvxFmmou2IhdPOKGia', '2015-07-16 10:26:56', '2015-07-16 10:26:56', 980190962)
|
4357
|
+
[1m[36mFixture Insert (0.0ms)[0m [1mINSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('two@example.net', '$2a$04$LvbNMrc1vHI8pnUO3O6sFummv4nXdKvH2/V7Tn6d40uRA/dUatK/2', '2015-07-16 10:26:56', '2015-07-16 10:26:56', 298486374)[0m
|
4358
|
+
[1m[35m (1.2ms)[0m commit transaction
|
4359
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
4360
|
+
---------------------------------------
|
4361
|
+
KnockTest: test_setup_block_yields_self
|
4362
|
+
---------------------------------------
|
4363
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
4364
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
4365
|
+
-----------------------------------------------------------------------------
|
4366
|
+
Knock::AuthTokenControllerTest: test_responds_with_404_if_user_does_not_exist
|
4367
|
+
-----------------------------------------------------------------------------
|
4368
|
+
Processing by Knock::AuthTokenController#create as HTML
|
4369
|
+
Parameters: {"auth"=>{"email"=>"wrong@example.net", "password"=>"[FILTERED]"}}
|
4370
|
+
[1m[35mUser Load (0.2ms)[0m SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "wrong@example.net"]]
|
4371
|
+
Completed 404 Not Found in 4ms (ActiveRecord: 0.2ms)
|
4372
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
4373
|
+
[1m[35m (0.1ms)[0m begin transaction
|
4374
|
+
-----------------------------------------------------------------------------
|
4375
|
+
Knock::AuthTokenControllerTest: test_responds_with_404_if_password_is_invalid
|
4376
|
+
-----------------------------------------------------------------------------
|
4377
|
+
[1m[36mUser Load (8.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
4378
|
+
Processing by Knock::AuthTokenController#create as HTML
|
4379
|
+
Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
|
4380
|
+
[1m[35mUser Load (0.0ms)[0m SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
|
4381
|
+
Completed 404 Not Found in 2ms (ActiveRecord: 0.0ms)
|
4382
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
4383
|
+
[1m[35m (0.1ms)[0m begin transaction
|
4384
|
+
------------------------------------------------------
|
4385
|
+
Knock::AuthTokenControllerTest: test_responds_with_201
|
4386
|
+
------------------------------------------------------
|
4387
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
4388
|
+
Processing by Knock::AuthTokenController#create as HTML
|
4389
|
+
Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
|
4390
|
+
[1m[35mUser Load (0.0ms)[0m SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
|
4391
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1[0m [["email", "one@example.net"]]
|
4392
|
+
Completed 201 Created in 7ms (Views: 0.2ms | ActiveRecord: 0.1ms)
|
4393
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
4394
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
4395
|
+
------------------------------------------------------------------------------
|
4396
|
+
ProtectedResourcesControllerTest: test_has_a_current_user_after_authentication
|
4397
|
+
------------------------------------------------------------------------------
|
4398
|
+
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
4399
|
+
Processing by ProtectedResourcesController#index as HTML
|
4400
|
+
[1m[36mUser Load (0.0ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
4401
|
+
Completed 200 OK in 1ms (ActiveRecord: 0.0ms)
|
4402
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
4403
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
4404
|
+
-----------------------------------------------------------------------------
|
4405
|
+
ProtectedResourcesControllerTest: test_responds_with_success_if_authenticated
|
4406
|
+
-----------------------------------------------------------------------------
|
4407
|
+
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
4408
|
+
Processing by ProtectedResourcesController#index as HTML
|
4409
|
+
[1m[36mUser Load (0.0ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
4410
|
+
Completed 200 OK in 0ms (ActiveRecord: 0.0ms)
|
4411
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
4412
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
4413
|
+
-----------------------------------------------------------------
|
4414
|
+
ProtectedResourcesControllerTest: test_responds_with_unauthorized
|
4415
|
+
-----------------------------------------------------------------
|
4416
|
+
Processing by ProtectedResourcesController#index as HTML
|
4417
|
+
Filter chain halted as :authenticate rendered or redirected
|
4418
|
+
Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
|
4419
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
4420
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
4421
|
+
----------------------------------------------------------------
|
4422
|
+
InstallGeneratorTest: test_Assert_all_files_are_properly_created
|
4423
|
+
----------------------------------------------------------------
|
4424
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
@@ -3,7 +3,7 @@ require 'test_helper'
|
|
3
3
|
class ProtectedResourcesControllerTest < ActionController::TestCase
|
4
4
|
def authenticate
|
5
5
|
@user = users(:one)
|
6
|
-
@token = Knock::AuthToken.new(payload: {
|
6
|
+
@token = Knock::AuthToken.new(payload: { sub: @user.id }).token
|
7
7
|
@request.env['HTTP_AUTHORIZATION'] = "Bearer #{@token}"
|
8
8
|
end
|
9
9
|
|
@@ -1,5 +1,16 @@
|
|
1
1
|
Knock.setup do |config|
|
2
2
|
|
3
|
+
## Current user retrieval when validating token
|
4
|
+
## --------------------------------------------
|
5
|
+
##
|
6
|
+
## This is how you can tell Knock how to retrieve the current_user.
|
7
|
+
## By default, it assumes you have a model called `User` and that
|
8
|
+
## the user_id is stored in the 'sub' claim.
|
9
|
+
##
|
10
|
+
## Default:
|
11
|
+
# config.current_user_from_token = -> (claims) { User.find claims['sub'] }
|
12
|
+
|
13
|
+
|
3
14
|
## Expiration claim
|
4
15
|
## ----------------
|
5
16
|
##
|
@@ -31,6 +42,6 @@ Knock.setup do |config|
|
|
31
42
|
# config.token_secret_signature_key = -> { Rails.application.secrets.secret_key_base }
|
32
43
|
|
33
44
|
## If using Auth0, uncomment the line below
|
34
|
-
# config.token_secret_signature_key = -> { Rails.application.secrets.auth0_client_secret }
|
45
|
+
# config.token_secret_signature_key = -> { JWT.base64url_decode Rails.application.secrets.auth0_client_secret }
|
35
46
|
|
36
47
|
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.
|
4
|
+
version: 1.2.0
|
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-
|
12
|
+
date: 2015-07-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|