nulogy_sso 0.3.0 → 0.3.1
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 +4 -4
- data/lib/nulogy_sso/test_utilities/{auth_mock.rb → auth0_mock.rb} +11 -17
- data/lib/nulogy_sso/test_utilities/{test_helper.rb → jwt_test_helper.rb} +7 -2
- data/lib/nulogy_sso/version.rb +1 -1
- data/spec/dummy/log/test.log +246 -0
- data/spec/examples.txt +14 -14
- data/spec/features/nulogy_sso/sso_login_spec.rb +9 -9
- data/spec/integration/services/nulogy_sso/authenticator_spec.rb +4 -4
- data/spec/rails_helper.rb +2 -2
- data/spec/support/mock_auth0_verifier.rb +0 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1abb297df46aca53cab17459f3c5c48fd2ec261ffba96a79a3c8059785eafc0b
|
4
|
+
data.tar.gz: e5febc2597680cf99ccb2cf2c7ddda0671987c2a0b3df6d3b03bdb704a474af6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4920a06889ea14c9f7a29c90f9f8bef5490f1881bffebf6a2351aaff307894d61b8017f21aa435ac55b378e933b75d232684fa29db1364318c26d080211d9472
|
7
|
+
data.tar.gz: a0e6d27e1a981e236f0c77830b1e29076fdcac67f476e38b180c10752fc1813be9d5a352c3ef1edc54c81a38333b43b33f975e6be855ef6df633350d24c1fb9f
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "curb"
|
4
|
-
|
4
|
+
require_relative "jwt_test_helper"
|
5
5
|
|
6
6
|
module NulogySSO
|
7
7
|
module TestUtilities
|
8
8
|
|
9
9
|
# This provides a simple mock implementation of Auth0 endpoints, via mockserver
|
10
|
-
class
|
10
|
+
class Auth0Mock
|
11
11
|
def initialize
|
12
|
-
@
|
12
|
+
@jwt_test_helper = NulogySSO::TestUtilities::JwtTestHelper.new
|
13
13
|
end
|
14
14
|
|
15
15
|
def setup_jwks
|
@@ -19,7 +19,7 @@ module NulogySSO
|
|
19
19
|
path: "/.well-known/jwks.json"
|
20
20
|
},
|
21
21
|
httpResponse: {
|
22
|
-
body: jwks_json
|
22
|
+
body: jwt_test_helper.jwks_json
|
23
23
|
}
|
24
24
|
)
|
25
25
|
end
|
@@ -58,25 +58,13 @@ module NulogySSO
|
|
58
58
|
)
|
59
59
|
end
|
60
60
|
|
61
|
-
def signed_jwt_response(email, overrides = {})
|
62
|
-
jwt = test_helper.jwt(email, overrides)
|
63
|
-
|
64
|
-
{ access_token: jwt }.to_json
|
65
|
-
end
|
66
|
-
|
67
61
|
def mockserver_reset
|
68
62
|
Curl.put(mockserver_url("reset"))
|
69
63
|
end
|
70
64
|
|
71
|
-
def jwks_json
|
72
|
-
jwks = JSON::JWK::Set.new(test_helper.jwk)
|
73
|
-
jwks.to_json
|
74
|
-
end
|
75
|
-
|
76
65
|
private
|
77
66
|
|
78
|
-
attr_reader :
|
79
|
-
delegate :private_key, to: :test_helper
|
67
|
+
attr_reader :jwt_test_helper
|
80
68
|
|
81
69
|
def mockserver_expectation(body)
|
82
70
|
Curl.put(mockserver_url("expectation"), body.to_json)
|
@@ -86,6 +74,12 @@ module NulogySSO
|
|
86
74
|
"#{ENV.fetch("NULOGY_SSO_MOCKSERVER_HOST")}:#{ENV.fetch("NULOGY_SSO_MOCKSERVER_PORT")}/mockserver/#{path}"
|
87
75
|
end
|
88
76
|
|
77
|
+
def signed_jwt_response(email, overrides = {})
|
78
|
+
jwt = jwt_test_helper.jwt(email, overrides)
|
79
|
+
|
80
|
+
{ access_token: jwt }.to_json
|
81
|
+
end
|
82
|
+
|
89
83
|
def capybara_current_host
|
90
84
|
@capybara_current_host ||= "http://#{Capybara.current_session.server.host}:#{Capybara.current_session.server.port}"
|
91
85
|
end
|
@@ -5,8 +5,9 @@ require "json/jwt"
|
|
5
5
|
module NulogySSO
|
6
6
|
module TestUtilities
|
7
7
|
|
8
|
-
#
|
9
|
-
class
|
8
|
+
# Test utilities that revolve around the JWT (JSON Web Token) protocool.
|
9
|
+
# This class is mostly a helpful wrapper around this gem: https://github.com/nov/json-jwt
|
10
|
+
class JwtTestHelper
|
10
11
|
def initialize
|
11
12
|
@private_key = OpenSSL::PKey::RSA.new(
|
12
13
|
File.read(File.expand_path("key.pem", __dir__))
|
@@ -43,6 +44,10 @@ module NulogySSO
|
|
43
44
|
)
|
44
45
|
end
|
45
46
|
|
47
|
+
def jwks_json
|
48
|
+
JSON::JWK::Set.new(jwk).to_json
|
49
|
+
end
|
50
|
+
|
46
51
|
private
|
47
52
|
|
48
53
|
def certificate_der
|
data/lib/nulogy_sso/version.rb
CHANGED
data/spec/dummy/log/test.log
CHANGED
@@ -3960,3 +3960,249 @@ Processing by NulogySSO::AuthenticationController#login as HTML
|
|
3960
3960
|
Redirected to http://localhost:1080/authorize?audience=mock_audience&client_id=mock_client_id&redirect_uri=mock_login_uri%3Forigin%3D&response_type=code&scope=openid+email
|
3961
3961
|
Completed 302 Found in 1ms (ActiveRecord: 0.0ms | Allocations: 159)
|
3962
3962
|
[1m[35m (0.5ms)[0m [1m[31mrollback transaction[0m
|
3963
|
+
[1m[35m (1.9ms)[0m [1m[34mSELECT sqlite_version(*)[0m
|
3964
|
+
[1m[35m (0.6ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ?[0m [["key", "schema_sha1"]]
|
3965
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT sqlite_version(*)[0m
|
3966
|
+
[1m[35m (0.5ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
3967
|
+
[1m[35m (0.2ms)[0m [1m[36mbegin transaction[0m
|
3968
|
+
[1m[35m (0.4ms)[0m [1m[35mSAVEPOINT active_record_1[0m
|
3969
|
+
[1m[36mUser Create (3.9ms)[0m [1m[32mINSERT INTO "users" ("email", "created_at", "updated_at") VALUES (?, ?, ?)[0m [["email", "test@nulogy.com"], ["created_at", "2019-09-23 19:46:49.849021"], ["updated_at", "2019-09-23 19:46:49.849021"]]
|
3970
|
+
[1m[35m (0.2ms)[0m [1m[35mRELEASE SAVEPOINT active_record_1[0m
|
3971
|
+
Started GET "/hello_world" for 10.2.2.127 at 2019-09-23 15:47:00 -0400
|
3972
|
+
Processing by ApplicationController#hello_world as HTML
|
3973
|
+
Redirected to http://10.2.2.127:56308/nulogy_sso/login
|
3974
|
+
Filter chain halted as :authenticate_sso_user rendered or redirected
|
3975
|
+
Completed 302 Found in 2ms (ActiveRecord: 0.0ms | Allocations: 576)
|
3976
|
+
Started GET "/nulogy_sso/login" for 10.2.2.127 at 2019-09-23 15:47:00 -0400
|
3977
|
+
Processing by NulogySSO::AuthenticationController#login as HTML
|
3978
|
+
Redirected to http://localhost:1080/authorize?audience=mock_audience&client_id=mock_client_id&redirect_uri=mock_login_uri%3Forigin%3D&response_type=code&scope=openid+email
|
3979
|
+
Completed 302 Found in 6ms (ActiveRecord: 0.0ms | Allocations: 220)
|
3980
|
+
[1m[35m (0.7ms)[0m [1m[31mrollback transaction[0m
|
3981
|
+
[1m[35m (0.1ms)[0m [1m[36mbegin transaction[0m
|
3982
|
+
[1m[35m (0.2ms)[0m [1m[35mSAVEPOINT active_record_1[0m
|
3983
|
+
[1m[36mUser Create (0.6ms)[0m [1m[32mINSERT INTO "users" ("email", "created_at", "updated_at") VALUES (?, ?, ?)[0m [["email", "test@nulogy.com"], ["created_at", "2019-09-23 19:47:02.368593"], ["updated_at", "2019-09-23 19:47:02.368593"]]
|
3984
|
+
[1m[35m (0.2ms)[0m [1m[35mRELEASE SAVEPOINT active_record_1[0m
|
3985
|
+
Started GET "/hello_world" for 10.2.2.127 at 2019-09-23 15:47:02 -0400
|
3986
|
+
Processing by ApplicationController#hello_world as HTML
|
3987
|
+
Redirected to http://10.2.2.127:56308/nulogy_sso/login
|
3988
|
+
Filter chain halted as :authenticate_sso_user rendered or redirected
|
3989
|
+
Completed 302 Found in 92ms (ActiveRecord: 0.0ms | Allocations: 2020)
|
3990
|
+
Started GET "/nulogy_sso/login" for 10.2.2.127 at 2019-09-23 15:47:02 -0400
|
3991
|
+
Processing by NulogySSO::AuthenticationController#login as HTML
|
3992
|
+
Redirected to http://localhost:1080/authorize?audience=mock_audience&client_id=mock_client_id&redirect_uri=mock_login_uri%3Forigin%3D&response_type=code&scope=openid+email
|
3993
|
+
Completed 302 Found in 1ms (ActiveRecord: 0.0ms | Allocations: 340)
|
3994
|
+
[1m[35m (0.4ms)[0m [1m[31mrollback transaction[0m
|
3995
|
+
[1m[35m (0.1ms)[0m [1m[36mbegin transaction[0m
|
3996
|
+
[1m[35m (0.1ms)[0m [1m[35mSAVEPOINT active_record_1[0m
|
3997
|
+
[1m[36mUser Create (0.4ms)[0m [1m[32mINSERT INTO "users" ("email", "created_at", "updated_at") VALUES (?, ?, ?)[0m [["email", "test@nulogy.com"], ["created_at", "2019-09-23 19:47:03.646699"], ["updated_at", "2019-09-23 19:47:03.646699"]]
|
3998
|
+
[1m[35m (0.1ms)[0m [1m[35mRELEASE SAVEPOINT active_record_1[0m
|
3999
|
+
Started GET "/hello_world" for 10.2.2.127 at 2019-09-23 15:47:04 -0400
|
4000
|
+
Processing by ApplicationController#hello_world as HTML
|
4001
|
+
[1m[36mUser Load (0.2ms)[0m [1m[34mSELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT ?[0m [["email", "test@nulogy.com"], ["LIMIT", 1]]
|
4002
|
+
Rendering text template
|
4003
|
+
Rendered text template (Duration: 0.0ms | Allocations: 3)
|
4004
|
+
Completed 200 OK in 9ms (Views: 5.5ms | ActiveRecord: 0.2ms | Allocations: 1814)
|
4005
|
+
[1m[35m (0.6ms)[0m [1m[31mrollback transaction[0m
|
4006
|
+
[1m[35m (0.1ms)[0m [1m[36mbegin transaction[0m
|
4007
|
+
Started GET "/hello_world" for 10.2.2.127 at 2019-09-23 15:47:05 -0400
|
4008
|
+
Processing by ApplicationController#hello_world as HTML
|
4009
|
+
Redirected to http://10.2.2.127:56308/nulogy_sso/login
|
4010
|
+
Filter chain halted as :authenticate_sso_user rendered or redirected
|
4011
|
+
Completed 302 Found in 1ms (ActiveRecord: 0.0ms | Allocations: 171)
|
4012
|
+
Started GET "/nulogy_sso/login" for 10.2.2.127 at 2019-09-23 15:47:05 -0400
|
4013
|
+
Processing by NulogySSO::AuthenticationController#login as HTML
|
4014
|
+
Redirected to http://localhost:1080/authorize?audience=mock_audience&client_id=mock_client_id&redirect_uri=mock_login_uri%3Forigin%3D&response_type=code&scope=openid+email
|
4015
|
+
Completed 302 Found in 1ms (ActiveRecord: 0.0ms | Allocations: 159)
|
4016
|
+
Started GET "/nulogy_sso/code?code=FAKE_CODE&origin=http%3A%2F%2F10.2.2.127%3A56308" for 10.2.2.127 at 2019-09-23 15:47:05 -0400
|
4017
|
+
Processing by NulogySSO::AuthenticationController#code as HTML
|
4018
|
+
Parameters: {"code"=>"FAKE_CODE", "origin"=>"http://10.2.2.127:56308"}
|
4019
|
+
[1m[36mUser Load (0.5ms)[0m [1m[34mSELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT ?[0m [["email", "test@nulogy.com"], ["LIMIT", 1]]
|
4020
|
+
Rendering text template
|
4021
|
+
Rendered text template (Duration: 0.1ms | Allocations: 1)
|
4022
|
+
Completed 200 OK in 86ms (Views: 1.7ms | ActiveRecord: 0.5ms | Allocations: 3832)
|
4023
|
+
[1m[35m (0.1ms)[0m [1m[31mrollback transaction[0m
|
4024
|
+
[1m[35m (0.2ms)[0m [1m[36mbegin transaction[0m
|
4025
|
+
[1m[35m (0.1ms)[0m [1m[35mSAVEPOINT active_record_1[0m
|
4026
|
+
[1m[36mUser Create (0.4ms)[0m [1m[32mINSERT INTO "users" ("email", "created_at", "updated_at") VALUES (?, ?, ?)[0m [["email", "test@nulogy.com"], ["created_at", "2019-09-23 19:47:06.000109"], ["updated_at", "2019-09-23 19:47:06.000109"]]
|
4027
|
+
[1m[35m (0.1ms)[0m [1m[35mRELEASE SAVEPOINT active_record_1[0m
|
4028
|
+
Started GET "/hello_world" for 10.2.2.127 at 2019-09-23 15:47:06 -0400
|
4029
|
+
Processing by ApplicationController#hello_world as HTML
|
4030
|
+
Redirected to http://10.2.2.127:56308/nulogy_sso/login
|
4031
|
+
Filter chain halted as :authenticate_sso_user rendered or redirected
|
4032
|
+
Completed 302 Found in 1ms (ActiveRecord: 0.0ms | Allocations: 171)
|
4033
|
+
Started GET "/nulogy_sso/login" for 10.2.2.127 at 2019-09-23 15:47:06 -0400
|
4034
|
+
Processing by NulogySSO::AuthenticationController#login as HTML
|
4035
|
+
Redirected to http://localhost:1080/authorize?audience=mock_audience&client_id=mock_client_id&redirect_uri=mock_login_uri%3Forigin%3D&response_type=code&scope=openid+email
|
4036
|
+
Completed 302 Found in 1ms (ActiveRecord: 0.0ms | Allocations: 159)
|
4037
|
+
Started GET "/nulogy_sso/code?code=FAKE_CODE&origin=http%3A%2F%2F10.2.2.127%3A56308%2Fhello_world" for 10.2.2.127 at 2019-09-23 15:47:06 -0400
|
4038
|
+
Processing by NulogySSO::AuthenticationController#code as HTML
|
4039
|
+
Parameters: {"code"=>"FAKE_CODE", "origin"=>"http://10.2.2.127:56308/hello_world"}
|
4040
|
+
[1m[36mUser Load (0.3ms)[0m [1m[34mSELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT ?[0m [["email", "test@nulogy.com"], ["LIMIT", 1]]
|
4041
|
+
Redirected to http://10.2.2.127:56308/hello_world
|
4042
|
+
Completed 302 Found in 57ms (ActiveRecord: 0.3ms | Allocations: 2481)
|
4043
|
+
Started GET "/hello_world" for 10.2.2.127 at 2019-09-23 15:47:06 -0400
|
4044
|
+
Processing by ApplicationController#hello_world as HTML
|
4045
|
+
[1m[36mUser Load (0.3ms)[0m [1m[34mSELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT ?[0m [["email", "test@nulogy.com"], ["LIMIT", 1]]
|
4046
|
+
Rendering text template
|
4047
|
+
Rendered text template (Duration: 0.1ms | Allocations: 1)
|
4048
|
+
Completed 200 OK in 4ms (Views: 1.1ms | ActiveRecord: 0.3ms | Allocations: 502)
|
4049
|
+
[1m[35m (0.4ms)[0m [1m[31mrollback transaction[0m
|
4050
|
+
[1m[35m (0.1ms)[0m [1m[36mbegin transaction[0m
|
4051
|
+
[1m[35m (0.1ms)[0m [1m[35mSAVEPOINT active_record_1[0m
|
4052
|
+
[1m[36mUser Create (0.4ms)[0m [1m[32mINSERT INTO "users" ("email", "created_at", "updated_at") VALUES (?, ?, ?)[0m [["email", "test@nulogy.com"], ["created_at", "2019-09-23 19:47:07.665881"], ["updated_at", "2019-09-23 19:47:07.665881"]]
|
4053
|
+
[1m[35m (0.1ms)[0m [1m[35mRELEASE SAVEPOINT active_record_1[0m
|
4054
|
+
Started GET "/hello_world" for 10.2.2.127 at 2019-09-23 15:47:07 -0400
|
4055
|
+
Processing by ApplicationController#hello_world as HTML
|
4056
|
+
Redirected to http://10.2.2.127:56308/nulogy_sso/login
|
4057
|
+
Filter chain halted as :authenticate_sso_user rendered or redirected
|
4058
|
+
Completed 302 Found in 1ms (ActiveRecord: 0.0ms | Allocations: 171)
|
4059
|
+
Started GET "/nulogy_sso/login" for 10.2.2.127 at 2019-09-23 15:47:07 -0400
|
4060
|
+
Processing by NulogySSO::AuthenticationController#login as HTML
|
4061
|
+
Redirected to http://localhost:1080/authorize?audience=mock_audience&client_id=mock_client_id&redirect_uri=mock_login_uri%3Forigin%3D&response_type=code&scope=openid+email
|
4062
|
+
Completed 302 Found in 1ms (ActiveRecord: 0.0ms | Allocations: 159)
|
4063
|
+
Started GET "/nulogy_sso/code?code=FAKE_CODE&origin=http%3A%2F%2F10.2.2.127%3A56308" for 10.2.2.127 at 2019-09-23 15:47:07 -0400
|
4064
|
+
Processing by NulogySSO::AuthenticationController#code as HTML
|
4065
|
+
Parameters: {"code"=>"FAKE_CODE", "origin"=>"http://10.2.2.127:56308"}
|
4066
|
+
Rendering text template
|
4067
|
+
Rendered text template (Duration: 0.1ms | Allocations: 1)
|
4068
|
+
Completed 200 OK in 62ms (Views: 0.9ms | ActiveRecord: 0.0ms | Allocations: 2185)
|
4069
|
+
[1m[35m (0.7ms)[0m [1m[31mrollback transaction[0m
|
4070
|
+
[1m[35m (0.1ms)[0m [1m[36mbegin transaction[0m
|
4071
|
+
[1m[35m (0.1ms)[0m [1m[31mrollback transaction[0m
|
4072
|
+
[1m[35m (0.1ms)[0m [1m[36mbegin transaction[0m
|
4073
|
+
[1m[35m (0.1ms)[0m [1m[31mrollback transaction[0m
|
4074
|
+
[1m[35m (0.1ms)[0m [1m[36mbegin transaction[0m
|
4075
|
+
[1m[35m (0.0ms)[0m [1m[31mrollback transaction[0m
|
4076
|
+
[1m[35m (0.1ms)[0m [1m[36mbegin transaction[0m
|
4077
|
+
[1m[35m (0.1ms)[0m [1m[31mrollback transaction[0m
|
4078
|
+
[1m[35m (0.1ms)[0m [1m[36mbegin transaction[0m
|
4079
|
+
[1m[35m (0.1ms)[0m [1m[31mrollback transaction[0m
|
4080
|
+
[1m[35m (0.0ms)[0m [1m[36mbegin transaction[0m
|
4081
|
+
[1m[35m (0.0ms)[0m [1m[31mrollback transaction[0m
|
4082
|
+
[1m[35m (0.1ms)[0m [1m[36mbegin transaction[0m
|
4083
|
+
[1m[35m (0.1ms)[0m [1m[31mrollback transaction[0m
|
4084
|
+
[1m[35m (0.1ms)[0m [1m[36mbegin transaction[0m
|
4085
|
+
[1m[35m (0.1ms)[0m [1m[31mrollback transaction[0m
|
4086
|
+
[1m[35m (1.9ms)[0m [1m[34mSELECT sqlite_version(*)[0m
|
4087
|
+
[1m[35m (0.6ms)[0m [1m[34mSELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ?[0m [["key", "schema_sha1"]]
|
4088
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT sqlite_version(*)[0m
|
4089
|
+
[1m[35m (0.1ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
4090
|
+
[1m[35m (0.3ms)[0m [1m[36mbegin transaction[0m
|
4091
|
+
[1m[35m (0.1ms)[0m [1m[31mrollback transaction[0m
|
4092
|
+
[1m[35m (0.1ms)[0m [1m[36mbegin transaction[0m
|
4093
|
+
[1m[35m (0.3ms)[0m [1m[31mrollback transaction[0m
|
4094
|
+
[1m[35m (0.2ms)[0m [1m[36mbegin transaction[0m
|
4095
|
+
[1m[35m (0.1ms)[0m [1m[31mrollback transaction[0m
|
4096
|
+
[1m[35m (0.1ms)[0m [1m[36mbegin transaction[0m
|
4097
|
+
[1m[35m (0.6ms)[0m [1m[31mrollback transaction[0m
|
4098
|
+
[1m[35m (1.4ms)[0m [1m[36mbegin transaction[0m
|
4099
|
+
[1m[35m (0.2ms)[0m [1m[31mrollback transaction[0m
|
4100
|
+
[1m[35m (0.1ms)[0m [1m[36mbegin transaction[0m
|
4101
|
+
[1m[35m (0.3ms)[0m [1m[31mrollback transaction[0m
|
4102
|
+
[1m[35m (0.4ms)[0m [1m[36mbegin transaction[0m
|
4103
|
+
[1m[35m (0.1ms)[0m [1m[31mrollback transaction[0m
|
4104
|
+
[1m[35m (0.0ms)[0m [1m[36mbegin transaction[0m
|
4105
|
+
[1m[35m (0.1ms)[0m [1m[31mrollback transaction[0m
|
4106
|
+
[1m[35m (0.3ms)[0m [1m[36mbegin transaction[0m
|
4107
|
+
[1m[35m (0.1ms)[0m [1m[35mSAVEPOINT active_record_1[0m
|
4108
|
+
[1m[36mUser Create (0.4ms)[0m [1m[32mINSERT INTO "users" ("email", "created_at", "updated_at") VALUES (?, ?, ?)[0m [["email", "test@nulogy.com"], ["created_at", "2019-09-23 19:47:47.229667"], ["updated_at", "2019-09-23 19:47:47.229667"]]
|
4109
|
+
[1m[35m (0.0ms)[0m [1m[35mRELEASE SAVEPOINT active_record_1[0m
|
4110
|
+
Started GET "/hello_world" for 10.2.2.127 at 2019-09-23 15:47:48 -0400
|
4111
|
+
Processing by ApplicationController#hello_world as HTML
|
4112
|
+
Redirected to http://10.2.2.127:56392/nulogy_sso/login
|
4113
|
+
Filter chain halted as :authenticate_sso_user rendered or redirected
|
4114
|
+
Completed 302 Found in 3ms (ActiveRecord: 0.0ms | Allocations: 568)
|
4115
|
+
Started GET "/nulogy_sso/login" for 10.2.2.127 at 2019-09-23 15:47:48 -0400
|
4116
|
+
Processing by NulogySSO::AuthenticationController#login as HTML
|
4117
|
+
Redirected to http://localhost:1080/authorize?audience=mock_audience&client_id=mock_client_id&redirect_uri=mock_login_uri%3Forigin%3D&response_type=code&scope=openid+email
|
4118
|
+
Completed 302 Found in 5ms (ActiveRecord: 0.0ms | Allocations: 219)
|
4119
|
+
Started GET "/nulogy_sso/code?code=FAKE_CODE&origin=http%3A%2F%2F10.2.2.127%3A56392" for 10.2.2.127 at 2019-09-23 15:47:49 -0400
|
4120
|
+
Processing by NulogySSO::AuthenticationController#code as HTML
|
4121
|
+
Parameters: {"code"=>"FAKE_CODE", "origin"=>"http://10.2.2.127:56392"}
|
4122
|
+
Rendering text template
|
4123
|
+
Rendered text template (Duration: 0.0ms | Allocations: 3)
|
4124
|
+
Completed 200 OK in 99ms (Views: 5.6ms | ActiveRecord: 0.0ms | Allocations: 4454)
|
4125
|
+
[1m[35m (0.5ms)[0m [1m[31mrollback transaction[0m
|
4126
|
+
[1m[35m (0.2ms)[0m [1m[36mbegin transaction[0m
|
4127
|
+
Started GET "/hello_world" for 10.2.2.127 at 2019-09-23 15:47:50 -0400
|
4128
|
+
Processing by ApplicationController#hello_world as HTML
|
4129
|
+
Redirected to http://10.2.2.127:56392/nulogy_sso/login
|
4130
|
+
Filter chain halted as :authenticate_sso_user rendered or redirected
|
4131
|
+
Completed 302 Found in 1ms (ActiveRecord: 0.0ms | Allocations: 171)
|
4132
|
+
Started GET "/nulogy_sso/login" for 10.2.2.127 at 2019-09-23 15:47:50 -0400
|
4133
|
+
Processing by NulogySSO::AuthenticationController#login as HTML
|
4134
|
+
Redirected to http://localhost:1080/authorize?audience=mock_audience&client_id=mock_client_id&redirect_uri=mock_login_uri%3Forigin%3D&response_type=code&scope=openid+email
|
4135
|
+
Completed 302 Found in 1ms (ActiveRecord: 0.0ms | Allocations: 159)
|
4136
|
+
Started GET "/nulogy_sso/code?code=FAKE_CODE&origin=http%3A%2F%2F10.2.2.127%3A56392" for 10.2.2.127 at 2019-09-23 15:47:50 -0400
|
4137
|
+
Processing by NulogySSO::AuthenticationController#code as HTML
|
4138
|
+
Parameters: {"code"=>"FAKE_CODE", "origin"=>"http://10.2.2.127:56392"}
|
4139
|
+
[1m[36mUser Load (0.5ms)[0m [1m[34mSELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT ?[0m [["email", "test@nulogy.com"], ["LIMIT", 1]]
|
4140
|
+
Rendering text template
|
4141
|
+
Rendered text template (Duration: 0.1ms | Allocations: 1)
|
4142
|
+
Completed 200 OK in 78ms (Views: 0.9ms | ActiveRecord: 0.5ms | Allocations: 4370)
|
4143
|
+
[1m[35m (0.1ms)[0m [1m[31mrollback transaction[0m
|
4144
|
+
[1m[35m (0.3ms)[0m [1m[36mbegin transaction[0m
|
4145
|
+
[1m[35m (0.1ms)[0m [1m[35mSAVEPOINT active_record_1[0m
|
4146
|
+
[1m[36mUser Create (0.6ms)[0m [1m[32mINSERT INTO "users" ("email", "created_at", "updated_at") VALUES (?, ?, ?)[0m [["email", "test@nulogy.com"], ["created_at", "2019-09-23 19:47:51.067553"], ["updated_at", "2019-09-23 19:47:51.067553"]]
|
4147
|
+
[1m[35m (0.1ms)[0m [1m[35mRELEASE SAVEPOINT active_record_1[0m
|
4148
|
+
Started GET "/hello_world" for 10.2.2.127 at 2019-09-23 15:47:51 -0400
|
4149
|
+
Processing by ApplicationController#hello_world as HTML
|
4150
|
+
Redirected to http://10.2.2.127:56392/nulogy_sso/login
|
4151
|
+
Filter chain halted as :authenticate_sso_user rendered or redirected
|
4152
|
+
Completed 302 Found in 1ms (ActiveRecord: 0.0ms | Allocations: 171)
|
4153
|
+
Started GET "/nulogy_sso/login" for 10.2.2.127 at 2019-09-23 15:47:51 -0400
|
4154
|
+
Processing by NulogySSO::AuthenticationController#login as HTML
|
4155
|
+
Redirected to http://localhost:1080/authorize?audience=mock_audience&client_id=mock_client_id&redirect_uri=mock_login_uri%3Forigin%3D&response_type=code&scope=openid+email
|
4156
|
+
Completed 302 Found in 1ms (ActiveRecord: 0.0ms | Allocations: 159)
|
4157
|
+
Started GET "/nulogy_sso/code?code=FAKE_CODE&origin=http%3A%2F%2F10.2.2.127%3A56392%2Fhello_world" for 10.2.2.127 at 2019-09-23 15:47:51 -0400
|
4158
|
+
Processing by NulogySSO::AuthenticationController#code as HTML
|
4159
|
+
Parameters: {"code"=>"FAKE_CODE", "origin"=>"http://10.2.2.127:56392/hello_world"}
|
4160
|
+
[1m[36mUser Load (0.2ms)[0m [1m[34mSELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT ?[0m [["email", "test@nulogy.com"], ["LIMIT", 1]]
|
4161
|
+
Redirected to http://10.2.2.127:56392/hello_world
|
4162
|
+
Completed 302 Found in 49ms (ActiveRecord: 0.2ms | Allocations: 2492)
|
4163
|
+
Started GET "/hello_world" for 10.2.2.127 at 2019-09-23 15:47:51 -0400
|
4164
|
+
Processing by ApplicationController#hello_world as HTML
|
4165
|
+
[1m[36mUser Load (0.1ms)[0m [1m[34mSELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT ?[0m [["email", "test@nulogy.com"], ["LIMIT", 1]]
|
4166
|
+
Rendering text template
|
4167
|
+
Rendered text template (Duration: 0.0ms | Allocations: 1)
|
4168
|
+
Completed 200 OK in 2ms (Views: 0.7ms | ActiveRecord: 0.1ms | Allocations: 649)
|
4169
|
+
[1m[35m (0.8ms)[0m [1m[31mrollback transaction[0m
|
4170
|
+
[1m[35m (0.1ms)[0m [1m[36mbegin transaction[0m
|
4171
|
+
[1m[35m (0.2ms)[0m [1m[35mSAVEPOINT active_record_1[0m
|
4172
|
+
[1m[36mUser Create (0.9ms)[0m [1m[32mINSERT INTO "users" ("email", "created_at", "updated_at") VALUES (?, ?, ?)[0m [["email", "test@nulogy.com"], ["created_at", "2019-09-23 19:47:51.967119"], ["updated_at", "2019-09-23 19:47:51.967119"]]
|
4173
|
+
[1m[35m (0.2ms)[0m [1m[35mRELEASE SAVEPOINT active_record_1[0m
|
4174
|
+
Started GET "/hello_world" for 10.2.2.127 at 2019-09-23 15:47:52 -0400
|
4175
|
+
Processing by ApplicationController#hello_world as HTML
|
4176
|
+
[1m[36mUser Load (0.3ms)[0m [1m[34mSELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT ?[0m [["email", "test@nulogy.com"], ["LIMIT", 1]]
|
4177
|
+
Rendering text template
|
4178
|
+
Rendered text template (Duration: 0.1ms | Allocations: 1)
|
4179
|
+
Completed 200 OK in 6ms (Views: 1.1ms | ActiveRecord: 0.3ms | Allocations: 502)
|
4180
|
+
[1m[35m (0.4ms)[0m [1m[31mrollback transaction[0m
|
4181
|
+
[1m[35m (0.2ms)[0m [1m[36mbegin transaction[0m
|
4182
|
+
[1m[35m (0.3ms)[0m [1m[35mSAVEPOINT active_record_1[0m
|
4183
|
+
[1m[36mUser Create (0.8ms)[0m [1m[32mINSERT INTO "users" ("email", "created_at", "updated_at") VALUES (?, ?, ?)[0m [["email", "test@nulogy.com"], ["created_at", "2019-09-23 19:47:54.143490"], ["updated_at", "2019-09-23 19:47:54.143490"]]
|
4184
|
+
[1m[35m (0.1ms)[0m [1m[35mRELEASE SAVEPOINT active_record_1[0m
|
4185
|
+
Started GET "/hello_world" for 10.2.2.127 at 2019-09-23 15:47:54 -0400
|
4186
|
+
Processing by ApplicationController#hello_world as HTML
|
4187
|
+
Redirected to http://10.2.2.127:56392/nulogy_sso/login
|
4188
|
+
Filter chain halted as :authenticate_sso_user rendered or redirected
|
4189
|
+
Completed 302 Found in 1ms (ActiveRecord: 0.0ms | Allocations: 171)
|
4190
|
+
Started GET "/nulogy_sso/login" for 10.2.2.127 at 2019-09-23 15:47:54 -0400
|
4191
|
+
Processing by NulogySSO::AuthenticationController#login as HTML
|
4192
|
+
Redirected to http://localhost:1080/authorize?audience=mock_audience&client_id=mock_client_id&redirect_uri=mock_login_uri%3Forigin%3D&response_type=code&scope=openid+email
|
4193
|
+
Completed 302 Found in 2ms (ActiveRecord: 0.0ms | Allocations: 159)
|
4194
|
+
[1m[35m (0.3ms)[0m [1m[31mrollback transaction[0m
|
4195
|
+
[1m[35m (0.1ms)[0m [1m[36mbegin transaction[0m
|
4196
|
+
[1m[35m (0.1ms)[0m [1m[35mSAVEPOINT active_record_1[0m
|
4197
|
+
[1m[36mUser Create (0.4ms)[0m [1m[32mINSERT INTO "users" ("email", "created_at", "updated_at") VALUES (?, ?, ?)[0m [["email", "test@nulogy.com"], ["created_at", "2019-09-23 19:47:55.948316"], ["updated_at", "2019-09-23 19:47:55.948316"]]
|
4198
|
+
[1m[35m (0.1ms)[0m [1m[35mRELEASE SAVEPOINT active_record_1[0m
|
4199
|
+
Started GET "/hello_world" for 10.2.2.127 at 2019-09-23 15:47:56 -0400
|
4200
|
+
Processing by ApplicationController#hello_world as HTML
|
4201
|
+
Redirected to http://10.2.2.127:56392/nulogy_sso/login
|
4202
|
+
Filter chain halted as :authenticate_sso_user rendered or redirected
|
4203
|
+
Completed 302 Found in 3ms (ActiveRecord: 0.0ms | Allocations: 353)
|
4204
|
+
Started GET "/nulogy_sso/login" for 10.2.2.127 at 2019-09-23 15:47:56 -0400
|
4205
|
+
Processing by NulogySSO::AuthenticationController#login as HTML
|
4206
|
+
Redirected to http://localhost:1080/authorize?audience=mock_audience&client_id=mock_client_id&redirect_uri=mock_login_uri%3Forigin%3D&response_type=code&scope=openid+email
|
4207
|
+
Completed 302 Found in 2ms (ActiveRecord: 0.0ms | Allocations: 340)
|
4208
|
+
[1m[35m (0.5ms)[0m [1m[31mrollback transaction[0m
|
data/spec/examples.txt
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
example_id | status | run_time |
|
2
2
|
--------------------------------------------------------------------- | ------ | --------------- |
|
3
|
-
./spec/features/nulogy_sso/sso_login_spec.rb[1:1:1] | passed |
|
4
|
-
./spec/features/nulogy_sso/sso_login_spec.rb[1:1:2] | passed |
|
5
|
-
./spec/features/nulogy_sso/sso_login_spec.rb[1:1:3] | passed |
|
6
|
-
./spec/features/nulogy_sso/sso_login_spec.rb[1:2:1] | passed |
|
7
|
-
./spec/features/nulogy_sso/sso_login_spec.rb[1:2:2] | passed |
|
8
|
-
./spec/features/nulogy_sso/sso_login_spec.rb[1:2:3] | passed |
|
9
|
-
./spec/integration/services/nulogy_sso/authenticator_spec.rb[1:1:1] | passed | 0.
|
10
|
-
./spec/integration/services/nulogy_sso/authenticator_spec.rb[1:1:2:1] | passed | 0.
|
11
|
-
./spec/integration/services/nulogy_sso/authenticator_spec.rb[1:1:2:2] | passed | 0.
|
12
|
-
./spec/integration/services/nulogy_sso/authenticator_spec.rb[1:1:3:1] | passed | 0.
|
13
|
-
./spec/integration/services/nulogy_sso/authenticator_spec.rb[1:2:1] | passed | 0.
|
14
|
-
./spec/integration/services/nulogy_sso/authenticator_spec.rb[1:2:2] | passed | 0.
|
15
|
-
./spec/integration/services/nulogy_sso/authenticator_spec.rb[1:2:3] | passed | 0.
|
16
|
-
./spec/integration/services/nulogy_sso/authenticator_spec.rb[1:2:4] | passed | 0.
|
3
|
+
./spec/features/nulogy_sso/sso_login_spec.rb[1:1:1] | passed | 1.06 seconds |
|
4
|
+
./spec/features/nulogy_sso/sso_login_spec.rb[1:1:2] | passed | 1.02 seconds |
|
5
|
+
./spec/features/nulogy_sso/sso_login_spec.rb[1:1:3] | passed | 3.32 seconds |
|
6
|
+
./spec/features/nulogy_sso/sso_login_spec.rb[1:2:1] | passed | 2.18 seconds |
|
7
|
+
./spec/features/nulogy_sso/sso_login_spec.rb[1:2:2] | passed | 1.88 seconds |
|
8
|
+
./spec/features/nulogy_sso/sso_login_spec.rb[1:2:3] | passed | 1.81 seconds |
|
9
|
+
./spec/integration/services/nulogy_sso/authenticator_spec.rb[1:1:1] | passed | 0.01087 seconds |
|
10
|
+
./spec/integration/services/nulogy_sso/authenticator_spec.rb[1:1:2:1] | passed | 0.02615 seconds |
|
11
|
+
./spec/integration/services/nulogy_sso/authenticator_spec.rb[1:1:2:2] | passed | 0.0203 seconds |
|
12
|
+
./spec/integration/services/nulogy_sso/authenticator_spec.rb[1:1:3:1] | passed | 0.0369 seconds |
|
13
|
+
./spec/integration/services/nulogy_sso/authenticator_spec.rb[1:2:1] | passed | 0.03127 seconds |
|
14
|
+
./spec/integration/services/nulogy_sso/authenticator_spec.rb[1:2:2] | passed | 0.02067 seconds |
|
15
|
+
./spec/integration/services/nulogy_sso/authenticator_spec.rb[1:2:3] | passed | 0.00746 seconds |
|
16
|
+
./spec/integration/services/nulogy_sso/authenticator_spec.rb[1:2:4] | passed | 0.01329 seconds |
|
@@ -5,12 +5,12 @@ require "feature_spec_helper"
|
|
5
5
|
module NulogySSO
|
6
6
|
RSpec.describe "the SSO login process", type: :feature, js: true do
|
7
7
|
let(:email) { "test@nulogy.com" }
|
8
|
-
let(:
|
9
|
-
let(:
|
8
|
+
let(:auth0_mock) { TestUtilities::Auth0Mock.new }
|
9
|
+
let(:jwt_test_helper) { TestUtilities::JwtTestHelper.new }
|
10
10
|
|
11
11
|
describe "login flow" do
|
12
12
|
it "can successfully login" do
|
13
|
-
|
13
|
+
auth0_mock.setup(email: email, redirect_path: "/hello_world")
|
14
14
|
create_user
|
15
15
|
|
16
16
|
visit "/hello_world"
|
@@ -19,7 +19,7 @@ module NulogySSO
|
|
19
19
|
end
|
20
20
|
|
21
21
|
it "shows an error page when the user can authorize with Auth0 but not exist in the app" do
|
22
|
-
|
22
|
+
auth0_mock.setup(email: email)
|
23
23
|
|
24
24
|
visit "/hello_world"
|
25
25
|
|
@@ -27,7 +27,7 @@ module NulogySSO
|
|
27
27
|
end
|
28
28
|
|
29
29
|
it "shows an error page when Auth0 throws an error" do
|
30
|
-
|
30
|
+
auth0_mock.setup(email: email, status_code: 403)
|
31
31
|
create_user
|
32
32
|
|
33
33
|
visit "/hello_world"
|
@@ -40,15 +40,15 @@ module NulogySSO
|
|
40
40
|
let!(:user) { create_user }
|
41
41
|
|
42
42
|
before do
|
43
|
-
|
44
|
-
|
43
|
+
auth0_mock.mockserver_reset
|
44
|
+
auth0_mock.setup_jwks
|
45
45
|
|
46
46
|
# have to visit an unauthenticated endpoint in order for capybara to have something to have a tab to set the cookie on
|
47
47
|
visit "/robots.txt"
|
48
48
|
end
|
49
49
|
|
50
50
|
it "allows a user with a valid JWT to visit a secured endpoint" do
|
51
|
-
set_access_token_cookie(
|
51
|
+
set_access_token_cookie(jwt_test_helper.jwt(email))
|
52
52
|
|
53
53
|
visit "/hello_world"
|
54
54
|
|
@@ -56,7 +56,7 @@ module NulogySSO
|
|
56
56
|
end
|
57
57
|
|
58
58
|
it "prevents sessions with invalid JWTs from accessing secured endpoints" do
|
59
|
-
set_access_token_cookie(
|
59
|
+
set_access_token_cookie(jwt_test_helper.jwt(email, "exp" => (Time.now - 1.day).to_i))
|
60
60
|
|
61
61
|
visit "/hello_world"
|
62
62
|
|
@@ -7,7 +7,7 @@ module NulogySSO
|
|
7
7
|
MockAuth0Verifier.new(
|
8
8
|
issuer: "#{auth_config.base_uri}/",
|
9
9
|
audience: auth_config.audience,
|
10
|
-
jwks:
|
10
|
+
jwks: jwt_test_helper.jwks_json
|
11
11
|
)
|
12
12
|
end
|
13
13
|
let(:default_authenticator) { Authenticator.new(verifier: verifier, find_user_by_email: find_a_user) }
|
@@ -17,9 +17,9 @@ module NulogySSO
|
|
17
17
|
let(:on_success) { spy("on_success") }
|
18
18
|
let(:on_invalid_token) { spy("on_invalid_token") }
|
19
19
|
let(:email) { "sso_test@nulogy.com" }
|
20
|
-
let(:valid_signed_token) {
|
21
|
-
let(:invalid_signed_token) {
|
22
|
-
let(:
|
20
|
+
let(:valid_signed_token) { jwt_test_helper.jwt(email) }
|
21
|
+
let(:invalid_signed_token) { jwt_test_helper.jwt(email, "exp" => 1.day.ago.to_i) }
|
22
|
+
let(:jwt_test_helper) { TestUtilities::JwtTestHelper.new }
|
23
23
|
|
24
24
|
describe "#validate_token" do
|
25
25
|
it "calls on_invalid_token when the access token is blank" do
|
data/spec/rails_helper.rb
CHANGED
@@ -10,8 +10,8 @@ require "rspec/rails"
|
|
10
10
|
|
11
11
|
Dir[NulogySSO::Engine.root.join("spec/support/**/*.rb")].each { |f| require f }
|
12
12
|
|
13
|
-
require "nulogy_sso/test_utilities/
|
14
|
-
require "nulogy_sso/test_utilities/
|
13
|
+
require "nulogy_sso/test_utilities/auth0_mock"
|
14
|
+
require "nulogy_sso/test_utilities/jwt_test_helper"
|
15
15
|
|
16
16
|
begin
|
17
17
|
ActiveRecord::Migration.maintain_test_schema!
|
@@ -4,7 +4,6 @@
|
|
4
4
|
# to still be used for verifying JWTs, but with a localhost JWKS specified.
|
5
5
|
# This code was adapted from the gem's test suite:
|
6
6
|
# https://github.com/DroidsOnRoids/auth0_rs256_jwt_verifier/blob/master/test/auth0_rs256_jwt_verifier_test.rb
|
7
|
-
|
8
7
|
class MockAuth0Verifier
|
9
8
|
def initialize(issuer:, audience:, jwks:)
|
10
9
|
@internal_verifier = Auth0RS256JWTVerifier.new(
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nulogy_sso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nulogy Corporation
|
@@ -186,10 +186,10 @@ files:
|
|
186
186
|
- lib/nulogy_sso.rb
|
187
187
|
- lib/nulogy_sso/controller_helper.rb
|
188
188
|
- lib/nulogy_sso/engine.rb
|
189
|
-
- lib/nulogy_sso/test_utilities/
|
189
|
+
- lib/nulogy_sso/test_utilities/auth0_mock.rb
|
190
190
|
- lib/nulogy_sso/test_utilities/cert.der
|
191
|
+
- lib/nulogy_sso/test_utilities/jwt_test_helper.rb
|
191
192
|
- lib/nulogy_sso/test_utilities/key.pem
|
192
|
-
- lib/nulogy_sso/test_utilities/test_helper.rb
|
193
193
|
- lib/nulogy_sso/version.rb
|
194
194
|
- spec/dummy/Rakefile
|
195
195
|
- spec/dummy/app/assets/config/manifest.js
|