openflighthpc / flight-control

0 stars 0 forks source link

Expiration of SSO Cookie Causes Application Errors #39

Closed ColonelPanicks closed 2 years ago

ColonelPanicks commented 2 years ago

When my SSO cookie has expired I hit the Rails "We're sorry, but something went wrong." screen.

The server logs provided the following information:

I, [2022-04-19T09:21:10.594120 #10648]  INFO -- : [4339d340-00d5-416f-b9ae-83e28e3789d8] Started GET "/" for ::1 at 2022-04-19 09:21:10 +0100
D, [2022-04-19T09:21:10.596165 #10648] DEBUG -- : [4339d340-00d5-416f-b9ae-83e28e3789d8]   User Load (0.3ms)  SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2  [["id", 12], ["LIMIT", 1]]
I, [2022-04-19T09:21:10.596887 #10648]  INFO -- : [4339d340-00d5-416f-b9ae-83e28e3789d8] Processing by ProjectsController#costs_breakdown as HTML
D, [2022-04-19T09:21:10.597789 #10648] DEBUG -- : [4339d340-00d5-416f-b9ae-83e28e3789d8]   User Load (0.2ms)  SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2  [["id", 12], ["LIMIT", 1]]
I, [2022-04-19T09:21:10.598379 #10648]  INFO -- : [4339d340-00d5-416f-b9ae-83e28e3789d8] Completed 500 Internal Server Error in 1ms (ActiveRecord: 0.2ms | Allocations: 485)
F, [2022-04-19T09:21:10.598870 #10648] FATAL -- : [4339d340-00d5-416f-b9ae-83e28e3789d8]
[4339d340-00d5-416f-b9ae-83e28e3789d8] JWT::ExpiredSignature (Signature has expired):
[4339d340-00d5-416f-b9ae-83e28e3789d8]
[4339d340-00d5-416f-b9ae-83e28e3789d8] lib/json_web_token.rb:15:in `decode'
[4339d340-00d5-416f-b9ae-83e28e3789d8] app/models/user.rb:28:in `from_jwt_token'
[4339d340-00d5-416f-b9ae-83e28e3789d8] app/controllers/application_controller.rb:35:in `authenticate_user_from_jwt!'

If I view a different SSO service (e.g. Flight Center) I am logged out and can proceed to log in. I presume that there is some handling missing for redirecting to the login screen of Flight Control when the cookie has expired.

ColonelPanicks commented 2 years ago

It looks like the cookie still remains and this causes issues signing in to Flight Center. Deleting the cookie allows for sign-in.

Screenshot 2022-04-19 at 09 29 47
ColonelPanicks commented 2 years ago

This issue arose from a missing SSO fix in the running server and misconfiguration in the production environment file. Closing.