knock 1.4.2 → 1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/app/controllers/knock/application_controller.rb +1 -1
- data/app/controllers/knock/auth_token_controller.rb +32 -7
- data/app/model/knock/auth_token.rb +31 -7
- data/lib/generators/knock/token_controller_generator.rb +25 -0
- data/lib/generators/templates/entity_token_controller.rb.erb +2 -0
- data/lib/generators/templates/knock.rb +25 -3
- data/lib/knock.rb +7 -0
- data/lib/knock/authenticable.rb +45 -6
- data/lib/knock/version.rb +1 -1
- data/test/controllers/knock/auth_token_controller_test.rb +11 -0
- data/test/dummy/app/controllers/admin_protected_controller.rb +7 -0
- data/test/dummy/app/controllers/admin_token_controller.rb +2 -0
- data/test/dummy/app/controllers/composite_name_entity_protected_controller.rb +7 -0
- data/test/dummy/app/controllers/vendor_protected_controller.rb +11 -0
- data/test/dummy/app/controllers/vendor_token_controller.rb +2 -0
- data/test/dummy/app/models/admin.rb +16 -0
- data/test/dummy/app/models/composite_name_entity.rb +3 -0
- data/test/dummy/app/models/vendor.rb +3 -0
- data/test/dummy/config/initializers/knock.rb +10 -0
- data/test/dummy/config/routes.rb +8 -0
- data/test/dummy/db/migrate/20160519075733_create_admins.rb +10 -0
- data/test/dummy/db/migrate/20160522051816_create_vendors.rb +10 -0
- data/test/dummy/db/migrate/20160522181712_create_composite_name_entities.rb +10 -0
- data/test/dummy/db/schema.rb +22 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +333 -91
- data/test/dummy/test/controllers/admin_protected_controller_test.rb +49 -0
- data/test/dummy/test/controllers/admin_token_controller_test.rb +22 -0
- data/test/dummy/test/controllers/composite_name_entity_protected_controller_test.rb +49 -0
- data/test/dummy/test/controllers/vendor_protected_controller_test.rb +55 -0
- data/test/dummy/test/controllers/vendor_token_controller_test.rb +22 -0
- data/test/dummy/test/models/admin_test.rb +7 -0
- data/test/dummy/test/models/vendor_test.rb +7 -0
- data/test/{dummy/test/fixtures/users.yml → fixtures/admins.yml} +1 -5
- data/test/fixtures/composite_name_entities.yml +5 -0
- data/test/fixtures/vendors.yml +5 -0
- data/test/generators/token_controller_generator_test.rb +31 -0
- data/test/model/knock/auth_token_test.rb +33 -9
- data/test/support/generators_test_helper.rb +9 -0
- data/test/test_helper.rb +9 -0
- data/test/tmp/app/controllers/admin_token_controller.rb +2 -0
- data/test/tmp/app/controllers/admin_user_token_controller.rb +2 -0
- data/test/tmp/app/controllers/user_admin_token_controller.rb +2 -0
- data/test/tmp/app/controllers/user_token_controller.rb +2 -0
- data/test/tmp/config/routes.rb +17 -0
- metadata +76 -6
- data/test/tmp/config/initializers/knock.rb +0 -86
data/test/dummy/db/schema.rb
CHANGED
@@ -11,7 +11,21 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
14
|
+
ActiveRecord::Schema.define(version: 20160522181712) do
|
15
|
+
|
16
|
+
create_table "admins", force: :cascade do |t|
|
17
|
+
t.string "email"
|
18
|
+
t.string "password_digest"
|
19
|
+
t.datetime "created_at", null: false
|
20
|
+
t.datetime "updated_at", null: false
|
21
|
+
end
|
22
|
+
|
23
|
+
create_table "composite_name_entities", force: :cascade do |t|
|
24
|
+
t.string "email"
|
25
|
+
t.string "password_digest"
|
26
|
+
t.datetime "created_at", null: false
|
27
|
+
t.datetime "updated_at", null: false
|
28
|
+
end
|
15
29
|
|
16
30
|
create_table "users", force: :cascade do |t|
|
17
31
|
t.string "email", null: false
|
@@ -20,4 +34,11 @@ ActiveRecord::Schema.define(version: 20150713101607) do
|
|
20
34
|
t.datetime "updated_at", null: false
|
21
35
|
end
|
22
36
|
|
37
|
+
create_table "vendors", force: :cascade do |t|
|
38
|
+
t.string "email"
|
39
|
+
t.string "password_digest"
|
40
|
+
t.datetime "created_at", null: false
|
41
|
+
t.datetime "updated_at", null: false
|
42
|
+
end
|
43
|
+
|
23
44
|
end
|
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
data/test/dummy/log/test.log
CHANGED
@@ -1,84 +1,166 @@
|
|
1
|
+
[1m[36m (4.6ms)[0m [1mCREATE TABLE "admins" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar, "password_digest" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) [0m
|
2
|
+
[1m[35m (1.8ms)[0m CREATE TABLE "composite_name_entities" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar, "password_digest" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
1
3
|
[1m[36m (1.9ms)[0m [1mCREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar NOT NULL, "password_digest" varchar NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) [0m
|
2
|
-
[1m[35m (1.7ms)[0m CREATE TABLE "
|
3
|
-
[1m[36m (
|
4
|
-
[1m[35m (
|
5
|
-
[1m[36m (
|
6
|
-
[1m[35m (
|
7
|
-
[1m[
|
8
|
-
[1m[35m (
|
9
|
-
[1m[
|
10
|
-
[1m[
|
11
|
-
[1m[
|
12
|
-
[1m[35m (
|
13
|
-
[1m[
|
4
|
+
[1m[35m (1.7ms)[0m CREATE TABLE "vendors" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar, "password_digest" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
5
|
+
[1m[36m (1.9ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar NOT NULL) [0m
|
6
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
7
|
+
[1m[36m (3.2ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
8
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
9
|
+
[1m[36m (1.9ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20160522181712')[0m
|
10
|
+
[1m[35m (1.4ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20150713101607')
|
11
|
+
[1m[36m (1.8ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20160519075733')[0m
|
12
|
+
[1m[35m (1.4ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20160522051816')
|
13
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
14
|
+
[1m[35m (0.1ms)[0m begin transaction
|
15
|
+
[1m[36mFixture Delete (0.2ms)[0m [1mDELETE FROM "admins"[0m
|
16
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "admins" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('admin.one@example.net', '$2a$04$A5FrTmvQlWisxRF39Z9ThOxtvxEv3sskQ8Cvu7pMyJOdxKe2.yGQK', '2016-05-29 13:50:27', '2016-05-29 13:50:27', 980190962)
|
17
|
+
[1m[36mFixture Delete (0.1ms)[0m [1mDELETE FROM "composite_name_entities"[0m
|
18
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "composite_name_entities" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('composite_name_entity.one@example.net', '$2a$04$btcUJSIV8A1I4v/PGOzg9uwbne073esS6ASsIe.d8w3GoPwv.gali', '2016-05-29 13:50:27', '2016-05-29 13:50:27', 980190962)
|
19
|
+
[1m[36mFixture Delete (0.1ms)[0m [1mDELETE FROM "users"[0m
|
20
|
+
[1m[35mFixture Insert (0.1ms)[0m INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('one@example.net', '$2a$04$AaJIO4VQSLrEs0Tr4MSc4euqVbJvlKEfWoM7VtwzSIqg3wmlw2bdK', '2016-05-29 13:50:27', '2016-05-29 13:50:27', 980190962)
|
21
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('two@example.net', '$2a$04$g2QbsDNtx7EXGF9oW/HyuOdMaCz9lkRM0dPCuGVVY32MSDkT5syaO', '2016-05-29 13:50:27', '2016-05-29 13:50:27', 298486374)[0m
|
22
|
+
[1m[35mFixture Delete (0.1ms)[0m DELETE FROM "vendors"
|
23
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "vendors" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('vendor.one@example.net', '$2a$04$jrsErgp1FpPx4Yoh0AVvFOQW6W3SixzpKgG54MDx4OLhEKl09Xc4W', '2016-05-29 13:50:27', '2016-05-29 13:50:27', 980190962)[0m
|
24
|
+
[1m[35m (1.9ms)[0m commit transaction
|
25
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
14
26
|
-----------------------------------------------------------------------------
|
15
|
-
|
27
|
+
VendorProtectedControllerTest: test_raises_method_missing_error_appropriately
|
16
28
|
-----------------------------------------------------------------------------
|
17
|
-
Processing by
|
18
|
-
Parameters: {"
|
19
|
-
|
20
|
-
|
21
|
-
[1m[36m (0.
|
22
|
-
|
29
|
+
Processing by VendorProtectedController#show as HTML
|
30
|
+
Parameters: {"id"=>"1"}
|
31
|
+
Completed 500 Internal Server Error in 1ms (ActiveRecord: 0.0ms)
|
32
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
33
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
34
|
+
--------------------------------------------------------------
|
35
|
+
VendorProtectedControllerTest: test_responds_with_unauthorized
|
36
|
+
--------------------------------------------------------------
|
37
|
+
Processing by VendorProtectedController#index as HTML
|
38
|
+
Filter chain halted as :authenticate_vendor rendered or redirected
|
39
|
+
Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
|
40
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
41
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
23
42
|
-----------------------------------------------------------------------------
|
24
|
-
|
43
|
+
VendorProtectedControllerTest: test_has_a_current_vendor_after_authentication
|
25
44
|
-----------------------------------------------------------------------------
|
26
|
-
[1m[
|
27
|
-
Processing by
|
28
|
-
|
29
|
-
|
30
|
-
|
45
|
+
[1m[35mVendor Load (0.2ms)[0m SELECT "vendors".* FROM "vendors" WHERE "vendors"."id" = ? LIMIT 1 [["id", 980190962]]
|
46
|
+
Processing by VendorProtectedController#index as HTML
|
47
|
+
[1m[36mVendor Load (0.1ms)[0m [1mSELECT "vendors".* FROM "vendors" WHERE "vendors"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
48
|
+
Completed 200 OK in 2ms (ActiveRecord: 0.1ms)
|
49
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
50
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
51
|
+
-------------------------------------------------------------------------------
|
52
|
+
VendorProtectedControllerTest: test_responds_with_unauthorized_to_invalid_token
|
53
|
+
-------------------------------------------------------------------------------
|
54
|
+
Processing by VendorProtectedController#index as HTML
|
55
|
+
Filter chain halted as :authenticate_vendor rendered or redirected
|
56
|
+
Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
|
57
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
58
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
59
|
+
--------------------------------------------------------------------------------
|
60
|
+
VendorProtectedControllerTest: test_responds_with_unauthorized_to_invalid_entity
|
61
|
+
--------------------------------------------------------------------------------
|
62
|
+
Processing by VendorProtectedController#index as HTML
|
63
|
+
[1m[35mVendor Load (0.1ms)[0m SELECT "vendors".* FROM "vendors" WHERE "vendors"."id" = ? LIMIT 1 [["id", 0]]
|
64
|
+
Filter chain halted as :authenticate_vendor rendered or redirected
|
65
|
+
Completed 401 Unauthorized in 1ms (ActiveRecord: 0.1ms)
|
66
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
67
|
+
[1m[35m (0.0ms)[0m begin transaction
|
68
|
+
--------------------------------------------------------------------------
|
69
|
+
VendorProtectedControllerTest: test_responds_with_success_if_authenticated
|
70
|
+
--------------------------------------------------------------------------
|
71
|
+
[1m[36mVendor Load (0.1ms)[0m [1mSELECT "vendors".* FROM "vendors" WHERE "vendors"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
72
|
+
Processing by VendorProtectedController#index as HTML
|
73
|
+
[1m[35mVendor Load (0.0ms)[0m SELECT "vendors".* FROM "vendors" WHERE "vendors"."id" = ? LIMIT 1 [["id", 980190962]]
|
74
|
+
Completed 200 OK in 1ms (ActiveRecord: 0.0ms)
|
31
75
|
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
32
76
|
[1m[35m (0.1ms)[0m begin transaction
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
[1m[
|
40
|
-
[1m[
|
41
|
-
|
77
|
+
--------------------------------------------------------------------------------------------
|
78
|
+
CompositeNameEntityProtectedControllerTest: test_responds_with_unauthorized_to_invalid_token
|
79
|
+
--------------------------------------------------------------------------------------------
|
80
|
+
Processing by CompositeNameEntityProtectedController#index as HTML
|
81
|
+
Filter chain halted as :authenticate_composite_name_entity rendered or redirected
|
82
|
+
Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
|
83
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
84
|
+
[1m[35m (0.0ms)[0m begin transaction
|
85
|
+
---------------------------------------------------------------------------------------------
|
86
|
+
CompositeNameEntityProtectedControllerTest: test_responds_with_unauthorized_to_invalid_entity
|
87
|
+
---------------------------------------------------------------------------------------------
|
88
|
+
Processing by CompositeNameEntityProtectedController#index as HTML
|
89
|
+
[1m[36mCompositeNameEntity Load (0.1ms)[0m [1mSELECT "composite_name_entities".* FROM "composite_name_entities" WHERE "composite_name_entities"."id" = ? LIMIT 1[0m [["id", 0]]
|
90
|
+
Filter chain halted as :authenticate_composite_name_entity rendered or redirected
|
91
|
+
Completed 401 Unauthorized in 1ms (ActiveRecord: 0.1ms)
|
42
92
|
[1m[35m (0.1ms)[0m rollback transaction
|
43
|
-
[1m[36m (0.
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
[1m[
|
48
|
-
Processing by
|
49
|
-
[1m[
|
93
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
94
|
+
---------------------------------------------------------------------------------------------------------
|
95
|
+
CompositeNameEntityProtectedControllerTest: test_has_a_current_composite_name_entity_after_authentication
|
96
|
+
---------------------------------------------------------------------------------------------------------
|
97
|
+
[1m[35mCompositeNameEntity Load (0.1ms)[0m SELECT "composite_name_entities".* FROM "composite_name_entities" WHERE "composite_name_entities"."id" = ? LIMIT 1 [["id", 980190962]]
|
98
|
+
Processing by CompositeNameEntityProtectedController#index as HTML
|
99
|
+
[1m[36mCompositeNameEntity Load (0.1ms)[0m [1mSELECT "composite_name_entities".* FROM "composite_name_entities" WHERE "composite_name_entities"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
50
100
|
Completed 200 OK in 1ms (ActiveRecord: 0.1ms)
|
101
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
102
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
103
|
+
---------------------------------------------------------------------------------------
|
104
|
+
CompositeNameEntityProtectedControllerTest: test_responds_with_success_if_authenticated
|
105
|
+
---------------------------------------------------------------------------------------
|
106
|
+
[1m[35mCompositeNameEntity Load (0.1ms)[0m SELECT "composite_name_entities".* FROM "composite_name_entities" WHERE "composite_name_entities"."id" = ? LIMIT 1 [["id", 980190962]]
|
107
|
+
Processing by CompositeNameEntityProtectedController#index as HTML
|
108
|
+
[1m[36mCompositeNameEntity Load (0.0ms)[0m [1mSELECT "composite_name_entities".* FROM "composite_name_entities" WHERE "composite_name_entities"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
109
|
+
Completed 200 OK in 1ms (ActiveRecord: 0.0ms)
|
110
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
111
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
112
|
+
---------------------------------------------------------------------------
|
113
|
+
CompositeNameEntityProtectedControllerTest: test_responds_with_unauthorized
|
114
|
+
---------------------------------------------------------------------------
|
115
|
+
Processing by CompositeNameEntityProtectedController#index as HTML
|
116
|
+
Filter chain halted as :authenticate_composite_name_entity rendered or redirected
|
117
|
+
Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
|
51
118
|
[1m[35m (0.1ms)[0m rollback transaction
|
52
119
|
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
[1m[
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
120
|
+
-------------------------------------------------------------------------
|
121
|
+
Knock::AuthTokenTest: test_verify_audience_when_token_audience_is_present
|
122
|
+
-------------------------------------------------------------------------
|
123
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
124
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
125
|
+
---------------------------------------------------------------
|
126
|
+
Knock::AuthTokenTest: test_validate_expiration_claim_by_default
|
127
|
+
---------------------------------------------------------------
|
61
128
|
[1m[35m (0.1ms)[0m rollback transaction
|
62
129
|
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
67
|
-
Processing by ProtectedResourcesController#index as HTML
|
68
|
-
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
69
|
-
Completed 200 OK in 1ms (ActiveRecord: 0.1ms)
|
130
|
+
----------------------------------------------------
|
131
|
+
Knock::AuthTokenTest: test_decode_RSA_encoded_tokens
|
132
|
+
----------------------------------------------------
|
70
133
|
[1m[35m (0.1ms)[0m rollback transaction
|
71
134
|
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
[1m[
|
135
|
+
---------------------------------------------------------------------------------------
|
136
|
+
Knock::AuthTokenTest: test_does_not_validate_expiration_claim_with_a_nil_token_lifetime
|
137
|
+
---------------------------------------------------------------------------------------
|
138
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
139
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
140
|
+
-------------------------------------------------
|
141
|
+
Knock::AuthTokenTest: test_encode_tokens_with_RSA
|
142
|
+
-------------------------------------------------
|
143
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
144
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
145
|
+
-------------------------------------------
|
146
|
+
Knock::AuthTokenTest: test_verify_algorithm
|
147
|
+
-------------------------------------------
|
148
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
149
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
150
|
+
------------------------------------------
|
151
|
+
Knock::AuthTokenTest: test_is_serializable
|
152
|
+
------------------------------------------
|
153
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
154
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
155
|
+
----------------------------------------------------------------------------------------------
|
156
|
+
ProtectedResourcesControllerTest: test_responds_with_unauthorized_with_invalid_token_in_header
|
157
|
+
----------------------------------------------------------------------------------------------
|
158
|
+
[1m[35mUser Load (0.2ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
76
159
|
Processing by ProtectedResourcesController#index as HTML
|
77
|
-
Parameters: {"token"=>"invalid"}
|
78
160
|
Filter chain halted as :authenticate rendered or redirected
|
79
161
|
Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
|
80
162
|
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
81
|
-
[1m[35m (0.
|
163
|
+
[1m[35m (0.0ms)[0m begin transaction
|
82
164
|
----------------------------------------------------------------------------------
|
83
165
|
ProtectedResourcesControllerTest: test_accepts_authorization_header_without_prefix
|
84
166
|
----------------------------------------------------------------------------------
|
@@ -88,15 +170,26 @@ Processing by ProtectedResourcesController#index as HTML
|
|
88
170
|
Completed 200 OK in 1ms (ActiveRecord: 0.1ms)
|
89
171
|
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
90
172
|
[1m[35m (0.1ms)[0m begin transaction
|
91
|
-
|
92
|
-
ProtectedResourcesControllerTest:
|
93
|
-
|
173
|
+
-------------------------------------------------------------------------------------------
|
174
|
+
ProtectedResourcesControllerTest: test_responds_with_unauthorized_with_invalid_token_in_url
|
175
|
+
-------------------------------------------------------------------------------------------
|
94
176
|
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
95
177
|
Processing by ProtectedResourcesController#index as HTML
|
178
|
+
Parameters: {"token"=>"invalid"}
|
96
179
|
Filter chain halted as :authenticate rendered or redirected
|
97
180
|
Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
|
98
181
|
[1m[35m (0.1ms)[0m rollback transaction
|
99
|
-
[1m[36m (0.
|
182
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
183
|
+
------------------------------------------------------------------------------
|
184
|
+
ProtectedResourcesControllerTest: test_responds_with_success_with_token_in_url
|
185
|
+
------------------------------------------------------------------------------
|
186
|
+
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
187
|
+
Processing by ProtectedResourcesController#index as HTML
|
188
|
+
Parameters: {"token"=>"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0NjQ2MTYyMjcsInN1YiI6OTgwMTkwOTYyfQ.ZioYbBATphHQTR5V7AbQ3XE9C-Y2AwSlJwIbFeMJAxA"}
|
189
|
+
[1m[36mUser Load (0.0ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
190
|
+
Completed 200 OK in 1ms (ActiveRecord: 0.0ms)
|
191
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
192
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
100
193
|
-----------------------------------------------------------------
|
101
194
|
ProtectedResourcesControllerTest: test_responds_with_unauthorized
|
102
195
|
-----------------------------------------------------------------
|
@@ -105,19 +198,32 @@ Processing by ProtectedResourcesController#index as HTML
|
|
105
198
|
Filter chain halted as :authenticate rendered or redirected
|
106
199
|
Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
|
107
200
|
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
108
|
-
[1m[35m (0.
|
109
|
-
|
110
|
-
ProtectedResourcesControllerTest:
|
111
|
-
|
201
|
+
[1m[35m (0.0ms)[0m begin transaction
|
202
|
+
-------------------------------------------------------------------------------------
|
203
|
+
ProtectedResourcesControllerTest: test_accepts_any_prefix_in_the_authorization_header
|
204
|
+
-------------------------------------------------------------------------------------
|
112
205
|
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
113
206
|
Processing by ProtectedResourcesController#index as HTML
|
114
207
|
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
115
208
|
Completed 200 OK in 1ms (ActiveRecord: 0.1ms)
|
116
209
|
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
117
|
-
[1m[35m (0.
|
118
|
-
|
119
|
-
|
120
|
-
|
210
|
+
[1m[35m (0.0ms)[0m begin transaction
|
211
|
+
------------------------------------------------------------------------------
|
212
|
+
ProtectedResourcesControllerTest: test_has_a_current_user_after_authentication
|
213
|
+
------------------------------------------------------------------------------
|
214
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
215
|
+
Processing by ProtectedResourcesController#index as HTML
|
216
|
+
[1m[35mUser Load (0.0ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
217
|
+
Completed 200 OK in 1ms (ActiveRecord: 0.0ms)
|
218
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
219
|
+
[1m[35m (0.0ms)[0m begin transaction
|
220
|
+
---------------------------------------------------------------------------------------
|
221
|
+
ProtectedResourcesControllerTest: test_responds_with_success_with_valid_token_in_header
|
222
|
+
---------------------------------------------------------------------------------------
|
223
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
224
|
+
Processing by ProtectedResourcesController#index as HTML
|
225
|
+
[1m[35mUser Load (0.0ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
226
|
+
Completed 200 OK in 1ms (ActiveRecord: 0.0ms)
|
121
227
|
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
122
228
|
[1m[35m (0.1ms)[0m begin transaction
|
123
229
|
--------------------------------------------------
|
@@ -128,7 +234,7 @@ Processing by CurrentUsersController#show as HTML
|
|
128
234
|
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
129
235
|
Completed 200 OK in 1ms (ActiveRecord: 0.1ms)
|
130
236
|
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
131
|
-
[1m[35m (0.
|
237
|
+
[1m[35m (0.0ms)[0m begin transaction
|
132
238
|
---------------------------------------------------------------------------
|
133
239
|
CurrentUsersControllerTest: test_responds_with_404_if_user_is_not_logged_in
|
134
240
|
---------------------------------------------------------------------------
|
@@ -137,28 +243,164 @@ Processing by CurrentUsersController#show as HTML
|
|
137
243
|
Completed 404 Not Found in 0ms (ActiveRecord: 0.0ms)
|
138
244
|
[1m[35m (0.1ms)[0m rollback transaction
|
139
245
|
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
140
|
-
|
141
|
-
|
142
|
-
|
246
|
+
----------------------------------------------------------------
|
247
|
+
InstallGeneratorTest: test_Assert_all_files_are_properly_created
|
248
|
+
----------------------------------------------------------------
|
143
249
|
[1m[35m (0.1ms)[0m rollback transaction
|
144
250
|
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
251
|
+
---------------------------------------
|
252
|
+
KnockTest: test_setup_block_yields_self
|
253
|
+
---------------------------------------
|
254
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
255
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
256
|
+
------------------------------------------------------------------------
|
257
|
+
VendorTokenControllerTest: test_responds_with_404_if_user_does_not_exist
|
258
|
+
------------------------------------------------------------------------
|
259
|
+
[1m[35mVendor Load (0.1ms)[0m SELECT "vendors".* FROM "vendors" WHERE "vendors"."id" = ? LIMIT 1 [["id", 980190962]]
|
260
|
+
Processing by VendorTokenController#create as HTML
|
261
|
+
Parameters: {"auth"=>{"email"=>"wrong@example.net", "password"=>"[FILTERED]"}}
|
262
|
+
[1m[36mVendor Load (0.1ms)[0m [1mSELECT "vendors".* FROM "vendors" WHERE "vendors"."email" = ? LIMIT 1[0m [["email", "wrong@example.net"]]
|
263
|
+
Completed 404 Not Found in 1ms (ActiveRecord: 0.1ms)
|
264
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
265
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
266
|
+
------------------------------------------------------------------------
|
267
|
+
VendorTokenControllerTest: test_responds_with_404_if_password_is_invalid
|
268
|
+
------------------------------------------------------------------------
|
269
|
+
[1m[35mVendor Load (0.1ms)[0m SELECT "vendors".* FROM "vendors" WHERE "vendors"."id" = ? LIMIT 1 [["id", 980190962]]
|
270
|
+
Processing by VendorTokenController#create as HTML
|
271
|
+
Parameters: {"auth"=>{"email"=>"vendor.one@example.net", "password"=>"[FILTERED]"}}
|
272
|
+
[1m[36mVendor Load (0.1ms)[0m [1mSELECT "vendors".* FROM "vendors" WHERE "vendors"."email" = ? LIMIT 1[0m [["email", "vendor.one@example.net"]]
|
273
|
+
Completed 404 Not Found in 2ms (ActiveRecord: 0.1ms)
|
274
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
275
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
145
276
|
-------------------------------------------------
|
146
|
-
|
277
|
+
VendorTokenControllerTest: test_responds_with_201
|
147
278
|
-------------------------------------------------
|
279
|
+
[1m[35mVendor Load (0.1ms)[0m SELECT "vendors".* FROM "vendors" WHERE "vendors"."id" = ? LIMIT 1 [["id", 980190962]]
|
280
|
+
Processing by VendorTokenController#create as HTML
|
281
|
+
Parameters: {"auth"=>{"email"=>"vendor.one@example.net", "password"=>"[FILTERED]"}}
|
282
|
+
[1m[36mVendor Load (0.0ms)[0m [1mSELECT "vendors".* FROM "vendors" WHERE "vendors"."email" = ? LIMIT 1[0m [["email", "vendor.one@example.net"]]
|
283
|
+
Completed 201 Created in 2ms (Views: 0.2ms | ActiveRecord: 0.0ms)
|
148
284
|
[1m[35m (0.1ms)[0m rollback transaction
|
149
285
|
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
[1m[
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
[1m[
|
286
|
+
-------------------------------------------------------------------------------
|
287
|
+
AdminProtectedControllerTest: test_responds_with_unauthorized_to_invalid_entity
|
288
|
+
-------------------------------------------------------------------------------
|
289
|
+
Processing by AdminProtectedController#index as HTML
|
290
|
+
[1m[35mAdmin Load (0.1ms)[0m SELECT "admins".* FROM "admins" WHERE "admins"."id" = ? LIMIT 1 [["id", 0]]
|
291
|
+
Filter chain halted as :authenticate_admin rendered or redirected
|
292
|
+
Completed 401 Unauthorized in 1ms (ActiveRecord: 0.1ms)
|
293
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
294
|
+
[1m[35m (0.0ms)[0m begin transaction
|
295
|
+
-------------------------------------------------------------------------
|
296
|
+
AdminProtectedControllerTest: test_responds_with_success_if_authenticated
|
297
|
+
-------------------------------------------------------------------------
|
298
|
+
[1m[36mAdmin Load (0.1ms)[0m [1mSELECT "admins".* FROM "admins" WHERE "admins"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
299
|
+
Processing by AdminProtectedController#index as HTML
|
300
|
+
[1m[35mAdmin Load (0.0ms)[0m SELECT "admins".* FROM "admins" WHERE "admins"."id" = ? LIMIT 1 [["id", 980190962]]
|
301
|
+
Completed 200 OK in 1ms (ActiveRecord: 0.0ms)
|
302
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
303
|
+
[1m[35m (0.0ms)[0m begin transaction
|
304
|
+
------------------------------------------------------------------------------
|
305
|
+
AdminProtectedControllerTest: test_responds_with_unauthorized_to_invalid_token
|
306
|
+
------------------------------------------------------------------------------
|
307
|
+
Processing by AdminProtectedController#index as HTML
|
308
|
+
Filter chain halted as :authenticate_admin rendered or redirected
|
309
|
+
Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
|
159
310
|
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
160
311
|
[1m[35m (0.1ms)[0m begin transaction
|
161
|
-
|
162
|
-
|
163
|
-
|
312
|
+
-------------------------------------------------------------
|
313
|
+
AdminProtectedControllerTest: test_responds_with_unauthorized
|
314
|
+
-------------------------------------------------------------
|
315
|
+
Processing by AdminProtectedController#index as HTML
|
316
|
+
Filter chain halted as :authenticate_admin rendered or redirected
|
317
|
+
Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
|
318
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
319
|
+
[1m[35m (0.0ms)[0m begin transaction
|
320
|
+
---------------------------------------------------------------------------
|
321
|
+
AdminProtectedControllerTest: test_has_a_current_admin_after_authentication
|
322
|
+
---------------------------------------------------------------------------
|
323
|
+
[1m[36mAdmin Load (0.1ms)[0m [1mSELECT "admins".* FROM "admins" WHERE "admins"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
324
|
+
Processing by AdminProtectedController#index as HTML
|
325
|
+
[1m[35mAdmin Load (0.1ms)[0m SELECT "admins".* FROM "admins" WHERE "admins"."id" = ? LIMIT 1 [["id", 980190962]]
|
326
|
+
Completed 200 OK in 1ms (ActiveRecord: 0.1ms)
|
327
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
328
|
+
[1m[35m (0.1ms)[0m begin transaction
|
329
|
+
------------------------------------------------
|
330
|
+
AdminTokenControllerTest: test_responds_with_201
|
331
|
+
------------------------------------------------
|
332
|
+
[1m[36mAdmin Load (0.1ms)[0m [1mSELECT "admins".* FROM "admins" WHERE "admins"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
333
|
+
Processing by AdminTokenController#create as HTML
|
334
|
+
Parameters: {"auth"=>{"email"=>"admin.one@example.net", "password"=>"[FILTERED]"}}
|
335
|
+
[1m[35mAdmin Load (0.1ms)[0m SELECT "admins".* FROM "admins" WHERE "admins"."email" = ? LIMIT 1 [["email", "admin.one@example.net"]]
|
336
|
+
Completed 201 Created in 3ms (Views: 0.2ms | ActiveRecord: 0.1ms)
|
337
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
338
|
+
[1m[35m (0.0ms)[0m begin transaction
|
339
|
+
-----------------------------------------------------------------------
|
340
|
+
AdminTokenControllerTest: test_responds_with_404_if_password_is_invalid
|
341
|
+
-----------------------------------------------------------------------
|
342
|
+
[1m[36mAdmin Load (0.1ms)[0m [1mSELECT "admins".* FROM "admins" WHERE "admins"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
343
|
+
Processing by AdminTokenController#create as HTML
|
344
|
+
Parameters: {"auth"=>{"email"=>"admin.one@example.net", "password"=>"[FILTERED]"}}
|
345
|
+
[1m[35mAdmin Load (0.0ms)[0m SELECT "admins".* FROM "admins" WHERE "admins"."email" = ? LIMIT 1 [["email", "admin.one@example.net"]]
|
346
|
+
Completed 404 Not Found in 2ms (ActiveRecord: 0.0ms)
|
347
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
348
|
+
[1m[35m (0.0ms)[0m begin transaction
|
349
|
+
-----------------------------------------------------------------------
|
350
|
+
AdminTokenControllerTest: test_responds_with_404_if_user_does_not_exist
|
351
|
+
-----------------------------------------------------------------------
|
352
|
+
[1m[36mAdmin Load (0.1ms)[0m [1mSELECT "admins".* FROM "admins" WHERE "admins"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
353
|
+
Processing by AdminTokenController#create as HTML
|
354
|
+
Parameters: {"auth"=>{"email"=>"wrong@example.net", "password"=>"[FILTERED]"}}
|
355
|
+
[1m[35mAdmin Load (0.0ms)[0m SELECT "admins".* FROM "admins" WHERE "admins"."email" = ? LIMIT 1 [["email", "wrong@example.net"]]
|
356
|
+
Completed 404 Not Found in 0ms (ActiveRecord: 0.0ms)
|
357
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
358
|
+
[1m[35m (0.1ms)[0m begin transaction
|
359
|
+
-----------------------------------------------------------------------------
|
360
|
+
Knock::AuthTokenControllerTest: test_responds_with_404_if_password_is_invalid
|
361
|
+
-----------------------------------------------------------------------------
|
362
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
363
|
+
Processing by Knock::AuthTokenController#create as HTML
|
364
|
+
Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
|
365
|
+
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
|
366
|
+
Completed 404 Not Found in 2ms (ActiveRecord: 0.1ms)
|
164
367
|
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
368
|
+
[1m[35m (0.1ms)[0m begin transaction
|
369
|
+
------------------------------------------------------
|
370
|
+
Knock::AuthTokenControllerTest: test_responds_with_201
|
371
|
+
------------------------------------------------------
|
372
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
373
|
+
Processing by Knock::AuthTokenController#create as HTML
|
374
|
+
Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
|
375
|
+
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
|
376
|
+
Completed 201 Created in 3ms (Views: 0.2ms | ActiveRecord: 0.1ms)
|
377
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
378
|
+
[1m[35m (0.0ms)[0m begin transaction
|
379
|
+
-----------------------------------------------------------------------------
|
380
|
+
Knock::AuthTokenControllerTest: test_responds_with_404_if_user_does_not_exist
|
381
|
+
-----------------------------------------------------------------------------
|
382
|
+
Processing by Knock::AuthTokenController#create as HTML
|
383
|
+
Parameters: {"auth"=>{"email"=>"wrong@example.net", "password"=>"[FILTERED]"}}
|
384
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1[0m [["email", "wrong@example.net"]]
|
385
|
+
Completed 404 Not Found in 1ms (ActiveRecord: 0.1ms)
|
386
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
387
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
388
|
+
---------------------------------------------------------------------------
|
389
|
+
Knock::AuthTokenControllerTest: test_it's_using_configured_custom_exception
|
390
|
+
---------------------------------------------------------------------------
|
391
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
392
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
393
|
+
------------------------------------------------------------
|
394
|
+
Knock::AuthTokenControllerTest: test_response_contains_token
|
395
|
+
------------------------------------------------------------
|
396
|
+
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
397
|
+
Processing by Knock::AuthTokenController#create as HTML
|
398
|
+
Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
|
399
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1[0m [["email", "one@example.net"]]
|
400
|
+
Completed 201 Created in 2ms (Views: 0.2ms | ActiveRecord: 0.1ms)
|
401
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
402
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
403
|
+
------------------------------------------------------------------------
|
404
|
+
TokenControllerGeneratorTest: test_assert_all_files_are_properly_created
|
405
|
+
------------------------------------------------------------------------
|
406
|
+
[1m[35m (0.1ms)[0m rollback transaction
|