knock 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/app/model/knock/auth_token.rb +10 -2
- data/lib/knock/version.rb +1 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +89 -89
- data/test/model/knock/auth_token_test.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Y2JmMzAwNjRhMDNiZTQ4ZWQwYzRjNDlhNzhjMzA1YzZmY2QzMTY2Yw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDMyNWRkNDA4NGI3NTk0MDBmNmI4ZGJlZmUzNDgyNTc0MmEyNGNhOQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YmIwZjc3Njc5NzdjMmMyMGM1NzlhNmY5Y2EyNWNiNzFhZDA2MWJkOWNhNjQ4
|
10
|
+
NTZlNWQwOTdlM2ZiZmY5OGZhY2Y3YjVjNDIzYThlZjJkZDcxNThiYmNlMDEw
|
11
|
+
MTJiMTllMGVmOTE5MjhiYTlkNTgzYjI2YzIxZGQwZGM1M2ZiNGM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjNiMWJmODQwNWI4MThlODBjYzVjNjBjY2ZhODU2YmRiNDNkMGM4NjllM2Q2
|
14
|
+
MTQyYjlhYTMwOGM3MzYyMDM1YWQwY2M0NjUwYWUwMTEwNjc5YjkyODVlOTFh
|
15
|
+
NDk3ODJkZjU3OTQyZDU2MTY2MzEzOGE5NTA0YTBmMGQzYmU1OGQ=
|
@@ -38,14 +38,22 @@ module Knock
|
|
38
38
|
def claims
|
39
39
|
{
|
40
40
|
exp: Knock.token_lifetime.from_now.to_i,
|
41
|
-
aud:
|
41
|
+
aud: token_audience
|
42
42
|
}
|
43
43
|
end
|
44
44
|
|
45
45
|
def verify_claims
|
46
46
|
{
|
47
|
-
aud:
|
47
|
+
aud: token_audience, verify_aud: verify_audience?
|
48
48
|
}
|
49
49
|
end
|
50
|
+
|
51
|
+
def token_audience
|
52
|
+
verify_audience? && Knock.token_audience.call
|
53
|
+
end
|
54
|
+
|
55
|
+
def verify_audience?
|
56
|
+
Knock.token_audience.present?
|
57
|
+
end
|
50
58
|
end
|
51
59
|
end
|
data/lib/knock/version.rb
CHANGED
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
data/test/dummy/log/test.log
CHANGED
@@ -1,36 +1,49 @@
|
|
1
|
-
[1m[36m (
|
2
|
-
[1m[35m (1.
|
1
|
+
[1m[36m (3.7ms)[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.4ms)[0m CREATE TABLE "schema_migrations" ("version" varchar NOT NULL)
|
3
3
|
[1m[36m (0.1ms)[0m [1mselect sqlite_version(*)[0m
|
4
|
-
[1m[35m (1.
|
4
|
+
[1m[35m (1.2ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
5
5
|
[1m[36m (0.1ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
6
|
-
[1m[35m (1.
|
6
|
+
[1m[35m (1.1ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20150713101607')
|
7
7
|
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
8
8
|
[1m[35m (0.1ms)[0m begin transaction
|
9
9
|
[1m[36mFixture Delete (0.2ms)[0m [1mDELETE FROM "users"[0m
|
10
|
-
[1m[35mFixture Insert (0.
|
11
|
-
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('two@example.net', '$2a$04$
|
12
|
-
[1m[35m (1.
|
10
|
+
[1m[35mFixture Insert (0.2ms)[0m INSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('one@example.net', '$2a$04$p5uJvjODelWvUMamobUYm.l7v1cL4QMmQQsFmdlQpZWa4xyWD6Zsa', '2016-01-08 12:37:37', '2016-01-08 12:37:37', 980190962)
|
11
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "users" ("email", "password_digest", "created_at", "updated_at", "id") VALUES ('two@example.net', '$2a$04$2hM6WVXy88h9vqb31eD4l.6jkUb6ppqstn5w.ixGo9hN3Sb76n5Ei', '2016-01-08 12:37:37', '2016-01-08 12:37:37', 298486374)[0m
|
12
|
+
[1m[35m (1.4ms)[0m commit transaction
|
13
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
14
|
+
---------------------------------------
|
15
|
+
KnockTest: test_setup_block_yields_self
|
16
|
+
---------------------------------------
|
17
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
13
18
|
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
19
|
+
--------------------------------------------------
|
20
|
+
CurrentUsersControllerTest: test_responds_with_200
|
21
|
+
--------------------------------------------------
|
22
|
+
[1m[35mUser Load (0.2ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
23
|
+
Processing by CurrentUsersController#show as HTML
|
24
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
25
|
+
Completed 200 OK in 2ms (ActiveRecord: 0.1ms)
|
26
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
27
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
28
|
+
---------------------------------------------------------------------------
|
29
|
+
CurrentUsersControllerTest: test_responds_with_404_if_user_is_not_logged_in
|
30
|
+
---------------------------------------------------------------------------
|
31
|
+
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
32
|
+
Processing by CurrentUsersController#show as HTML
|
33
|
+
Completed 404 Not Found in 0ms (ActiveRecord: 0.0ms)
|
34
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
35
|
+
[1m[35m (0.1ms)[0m begin transaction
|
14
36
|
------------------------------------------------------
|
15
37
|
Knock::AuthTokenControllerTest: test_responds_with_201
|
16
38
|
------------------------------------------------------
|
17
|
-
[1m[
|
39
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
18
40
|
Processing by Knock::AuthTokenController#create as HTML
|
19
41
|
Parameters: {"auth"=>{"email"=>"one@example.net", "password"=>"[FILTERED]"}}
|
20
|
-
[1m[
|
21
|
-
[1m[
|
22
|
-
Completed 201 Created in
|
23
|
-
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
24
|
-
[1m[35m (0.1ms)[0m begin transaction
|
25
|
-
-----------------------------------------------------------------------------
|
26
|
-
Knock::AuthTokenControllerTest: test_responds_with_404_if_user_does_not_exist
|
27
|
-
-----------------------------------------------------------------------------
|
28
|
-
Processing by Knock::AuthTokenController#create as HTML
|
29
|
-
Parameters: {"auth"=>{"email"=>"wrong@example.net", "password"=>"[FILTERED]"}}
|
30
|
-
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1[0m [["email", "wrong@example.net"]]
|
31
|
-
Completed 404 Not Found in 1ms (ActiveRecord: 0.1ms)
|
42
|
+
[1m[35mUser Load (0.2ms)[0m SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "one@example.net"]]
|
43
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1[0m [["email", "one@example.net"]]
|
44
|
+
Completed 201 Created in 3ms (Views: 0.2ms | ActiveRecord: 0.2ms)
|
32
45
|
[1m[35m (0.1ms)[0m rollback transaction
|
33
|
-
[1m[36m (0.
|
46
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
34
47
|
-----------------------------------------------------------------------------
|
35
48
|
Knock::AuthTokenControllerTest: test_responds_with_404_if_password_is_invalid
|
36
49
|
-----------------------------------------------------------------------------
|
@@ -41,46 +54,52 @@ Processing by Knock::AuthTokenController#create as HTML
|
|
41
54
|
Completed 404 Not Found in 2ms (ActiveRecord: 0.1ms)
|
42
55
|
[1m[35m (0.1ms)[0m rollback transaction
|
43
56
|
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
44
|
-
|
45
|
-
Knock::
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
-------------------------------------------------
|
52
|
-
[1m[35m (0.1ms)[0m rollback transaction
|
53
|
-
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
54
|
-
-------------------------------------------
|
55
|
-
Knock::AuthTokenTest: test_verify_algorithm
|
56
|
-
-------------------------------------------
|
57
|
-
[1m[35m (0.1ms)[0m rollback transaction
|
58
|
-
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
59
|
-
----------------------------------------------------
|
60
|
-
Knock::AuthTokenTest: test_decode_RSA_encoded_tokens
|
61
|
-
----------------------------------------------------
|
62
|
-
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
57
|
+
-----------------------------------------------------------------------------
|
58
|
+
Knock::AuthTokenControllerTest: test_responds_with_404_if_user_does_not_exist
|
59
|
+
-----------------------------------------------------------------------------
|
60
|
+
Processing by Knock::AuthTokenController#create as HTML
|
61
|
+
Parameters: {"auth"=>{"email"=>"wrong@example.net", "password"=>"[FILTERED]"}}
|
62
|
+
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT 1 [["email", "wrong@example.net"]]
|
63
|
+
Completed 404 Not Found in 1ms (ActiveRecord: 0.1ms)
|
63
64
|
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
64
65
|
[1m[35m (0.1ms)[0m begin transaction
|
65
|
-
|
66
|
-
ProtectedResourcesControllerTest:
|
67
|
-
|
66
|
+
-----------------------------------------------------------------
|
67
|
+
ProtectedResourcesControllerTest: test_responds_with_unauthorized
|
68
|
+
-----------------------------------------------------------------
|
68
69
|
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
69
70
|
Processing by ProtectedResourcesController#index as HTML
|
70
|
-
Parameters: {"token"=>"invalid"}
|
71
71
|
Filter chain halted as :authenticate rendered or redirected
|
72
72
|
Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
|
73
73
|
[1m[35m (0.1ms)[0m rollback transaction
|
74
|
-
[1m[36m (0.
|
75
|
-
|
76
|
-
ProtectedResourcesControllerTest:
|
77
|
-
|
74
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
75
|
+
---------------------------------------------------------------------------------------
|
76
|
+
ProtectedResourcesControllerTest: test_responds_with_success_with_valid_token_in_header
|
77
|
+
---------------------------------------------------------------------------------------
|
78
78
|
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
79
79
|
Processing by ProtectedResourcesController#index as HTML
|
80
|
+
[1m[36mUser Load (0.0ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
81
|
+
Completed 200 OK in 1ms (ActiveRecord: 0.0ms)
|
82
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
83
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
84
|
+
-------------------------------------------------------------------------------------------
|
85
|
+
ProtectedResourcesControllerTest: test_responds_with_unauthorized_with_invalid_token_in_url
|
86
|
+
-------------------------------------------------------------------------------------------
|
87
|
+
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
88
|
+
Processing by ProtectedResourcesController#index as HTML
|
89
|
+
Parameters: {"token"=>"invalid"}
|
80
90
|
Filter chain halted as :authenticate rendered or redirected
|
81
91
|
Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
|
82
92
|
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
83
|
-
[1m[35m (0.
|
93
|
+
[1m[35m (0.0ms)[0m begin transaction
|
94
|
+
------------------------------------------------------------------------------
|
95
|
+
ProtectedResourcesControllerTest: test_has_a_current_user_after_authentication
|
96
|
+
------------------------------------------------------------------------------
|
97
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
98
|
+
Processing by ProtectedResourcesController#index as HTML
|
99
|
+
[1m[35mUser Load (0.0ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
100
|
+
Completed 200 OK in 1ms (ActiveRecord: 0.0ms)
|
101
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
102
|
+
[1m[35m (0.0ms)[0m begin transaction
|
84
103
|
----------------------------------------------------------------------------------------------
|
85
104
|
ProtectedResourcesControllerTest: test_responds_with_unauthorized_with_invalid_token_in_header
|
86
105
|
----------------------------------------------------------------------------------------------
|
@@ -89,58 +108,39 @@ Processing by ProtectedResourcesController#index as HTML
|
|
89
108
|
Filter chain halted as :authenticate rendered or redirected
|
90
109
|
Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
|
91
110
|
[1m[35m (0.1ms)[0m rollback transaction
|
92
|
-
[1m[36m (0.
|
111
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
93
112
|
------------------------------------------------------------------------------
|
94
113
|
ProtectedResourcesControllerTest: test_responds_with_success_with_token_in_url
|
95
114
|
------------------------------------------------------------------------------
|
96
115
|
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
97
116
|
Processing by ProtectedResourcesController#index as HTML
|
98
|
-
Parameters: {"token"=>"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.
|
99
|
-
[1m[36mUser Load (0.
|
100
|
-
Completed 200 OK in 1ms (ActiveRecord: 0.
|
101
|
-
[1m[35m (0.1ms)[0m rollback transaction
|
102
|
-
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
103
|
-
------------------------------------------------------------------------------
|
104
|
-
ProtectedResourcesControllerTest: test_has_a_current_user_after_authentication
|
105
|
-
------------------------------------------------------------------------------
|
106
|
-
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
107
|
-
Processing by ProtectedResourcesController#index as HTML
|
108
|
-
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
109
|
-
Completed 200 OK in 1ms (ActiveRecord: 0.1ms)
|
110
|
-
[1m[35m (0.1ms)[0m rollback transaction
|
111
|
-
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
112
|
-
---------------------------------------------------------------------------------------
|
113
|
-
ProtectedResourcesControllerTest: test_responds_with_success_with_valid_token_in_header
|
114
|
-
---------------------------------------------------------------------------------------
|
115
|
-
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
116
|
-
Processing by ProtectedResourcesController#index as HTML
|
117
|
-
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
118
|
-
Completed 200 OK in 1ms (ActiveRecord: 0.1ms)
|
117
|
+
Parameters: {"token"=>"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0NTIzNDMwNTcsImF1ZCI6ZmFsc2UsInN1YiI6OTgwMTkwOTYyfQ._LmEq4p__HN1QJJugtREjx2fhFHfDM64ZZ3DYp8E17k"}
|
118
|
+
[1m[36mUser Load (0.0ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
119
|
+
Completed 200 OK in 1ms (ActiveRecord: 0.0ms)
|
119
120
|
[1m[35m (0.1ms)[0m rollback transaction
|
120
121
|
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
[1m[35mUser Load (0.2ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
125
|
-
Processing by CurrentUsersController#show as HTML
|
126
|
-
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1[0m [["id", 980190962]]
|
127
|
-
Completed 200 OK in 1ms (ActiveRecord: 0.1ms)
|
122
|
+
----------------------------------------------------------------
|
123
|
+
InstallGeneratorTest: test_Assert_all_files_are_properly_created
|
124
|
+
----------------------------------------------------------------
|
128
125
|
[1m[35m (0.1ms)[0m rollback transaction
|
129
126
|
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
130
|
-
|
131
|
-
|
132
|
-
|
127
|
+
----------------------------------------------------
|
128
|
+
Knock::AuthTokenTest: test_decode_RSA_encoded_tokens
|
129
|
+
----------------------------------------------------
|
133
130
|
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 980190962]]
|
134
|
-
Processing by CurrentUsersController#show as HTML
|
135
|
-
Completed 404 Not Found in 0ms (ActiveRecord: 0.0ms)
|
136
131
|
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
137
132
|
[1m[35m (0.1ms)[0m begin transaction
|
138
|
-
|
139
|
-
|
140
|
-
|
133
|
+
-------------------------------------------------
|
134
|
+
Knock::AuthTokenTest: test_encode_tokens_with_RSA
|
135
|
+
-------------------------------------------------
|
141
136
|
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
142
137
|
[1m[35m (0.1ms)[0m begin transaction
|
143
|
-
|
144
|
-
|
145
|
-
|
138
|
+
-------------------------------------------------------------------------
|
139
|
+
Knock::AuthTokenTest: test_verify_audience_when_token_audience_is_present
|
140
|
+
-------------------------------------------------------------------------
|
141
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
142
|
+
[1m[35m (0.0ms)[0m begin transaction
|
143
|
+
-------------------------------------------
|
144
|
+
Knock::AuthTokenTest: test_verify_algorithm
|
145
|
+
-------------------------------------------
|
146
146
|
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
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.
|
4
|
+
version: 1.4.1
|
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: 2016-01-
|
12
|
+
date: 2016-01-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|