standard_id 0.26.2 → 0.26.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dde5f52a936c2e51f795216d21fa5bf700f897f55ef5cd843ac15cb42f7ddf0c
4
- data.tar.gz: 106311d1a7228cf3686669cb5588b9db9b0e2b17fdb53247e715275bfd5db7ec
3
+ metadata.gz: a44aeb31a30319f06f305078bc0d9f0f5c20eff095680f3414085a7fb031c39c
4
+ data.tar.gz: 05bb225c7724ece28d0702345fe8f0560bef3e69d972a4b5f82ee3f97a304048
5
5
  SHA512:
6
- metadata.gz: dcdc4eb6ac8a332ec8ffc9fcb56baee4b3205fb23133192d9c4500497f92f9403212b429e0616dafb8accd62491ee4e09621928e97244ff95c7098f33cfdf144
7
- data.tar.gz: 9f4ea2218791b46ef44d6866de2bf85c3d3dfece82c64141a1f70895c1dc976e82c3c61dae0bbade82c2279d72466a10fe3da7bb212a70f6c90e421e0e56d556
6
+ metadata.gz: 4d796392613832ea4987009991eb1c191936a492cfe60e69964ee28416c9e6c5715263499bf12045563bf9d861996f07fc6eca0def955e776dbf25cbb4f2b833
7
+ data.tar.gz: e12e0634851c73da51edff7433392bf44ce721fbc078dc993cee9f6035bec336ca60b38c2d0897e9a0478075d32ff9984c0ecfb1063882a9cfcf814501a2e75b
@@ -16,8 +16,26 @@ module StandardId
16
16
  before_action -> { Current.scope = :web if defined?(::Current) }
17
17
  before_action :require_browser_session!
18
18
 
19
+ # The authentication guard (require_browser_session!) RAISES when a page
20
+ # requires a session that's missing / expired / revoked, rather than
21
+ # redirecting. The API base controller rescues the same errors; the web
22
+ # flow must too, or an unauthenticated request to a protected page (e.g.
23
+ # /sessions) surfaces as a 500 instead of bouncing to login. Expired and
24
+ # revoked sessions are InvalidSessionError subclasses.
25
+ rescue_from StandardId::NotAuthenticatedError,
26
+ StandardId::InvalidSessionError,
27
+ with: :redirect_unauthenticated_to_login
28
+
19
29
  private
20
30
 
31
+ # Bounce an unauthenticated web request to the login page, preserving the
32
+ # original destination (the guard already stored return_to_after_authenticating;
33
+ # redirect_to_login also carries it as a ?redirect_uri= param).
34
+ def redirect_unauthenticated_to_login(_error)
35
+ store_location_for_redirect
36
+ redirect_to_login
37
+ end
38
+
21
39
  # Read a top-level query/form param expected to be a scalar String, returning
22
40
  # nil for absent/blank values OR if Rails parsed it as an Array/Hash (e.g. from
23
41
  # `?redirect_uri[]=a&redirect_uri[]=b`). Without this guard, `redirect_to` is
@@ -1,3 +1,3 @@
1
1
  module StandardId
2
- VERSION = "0.26.2"
2
+ VERSION = "0.26.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standard_id
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.2
4
+ version: 0.26.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaryl Sim