prx_auth-rails 5.0.1 → 5.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78518e6f1ac8806d8b51a50834bfe59208bb778ff277e1685572268b30a41647
4
- data.tar.gz: a855a3b4967db5f7bdfbca77d555d4d06e6cc482fd3caa85e6285b280ac441c4
3
+ metadata.gz: 593c20d8991992610c9a7e73cf0ffe4062ba0f94d26cdf36861183e5f5fc911d
4
+ data.tar.gz: 75d29effb6538795f0f1ca09a23081a2f8931e6230aa9b570b3abc12b2c3b9c6
5
5
  SHA512:
6
- metadata.gz: 9d6d5ce5d77f09e51092482773890e9b27826e2dab76d4912cccb123ec361c1f4acee0a2076c553deb94cc7981ea89e8a7546ea4e561aa18621986c638102802
7
- data.tar.gz: 59c1622e39c4ba7ad666bc8948ca68f495b87083a4f240068666688579ca6945187ad9d099297b872bf9d9e41d4f2d89c82691088c81ed4668e9e2f4e9de510e
6
+ metadata.gz: 62cadaa6c14ec9950eb4564625bec317ea7181456884176afbd18315cb64b0736b34102302b3c228077b55ac7027857fcfb40e5be352e0adb500cd1a46d9ae71
7
+ data.tar.gz: 3105d11533f4260c785c57aa16cf34939926de93728c13975d678eae2917bb9c648c77344a5934cffd537578fd318d05914ebf5ce9ad0d0a7ee63b488507c96d
@@ -2,7 +2,7 @@
2
2
 
3
3
  module PrxAuth::Rails
4
4
  class SessionsController < ApplicationController
5
- skip_before_action :set_after_sign_in_path, :authenticate!, raise: false
5
+ skip_before_action :authenticate!, raise: false
6
6
 
7
7
  before_action :set_nonce!, only: [:new, :show]
8
8
 
@@ -70,6 +70,7 @@ module PrxAuth::Rails
70
70
  sign_out_user
71
71
  session[WILDCARD_SESSION_KEY] = wildcard
72
72
 
73
+ set_after_sign_in_path(request.referer.presence || "/")
73
74
  redirect_to new_sessions_path
74
75
  end
75
76
 
@@ -18,7 +18,7 @@ module PrxAuth
18
18
  PRX_REFRESH_BACK_KEY = "prx.auth.back".freeze
19
19
 
20
20
  included do
21
- before_action :set_after_sign_in_path, :authenticate!
21
+ before_action :authenticate!
22
22
  end
23
23
 
24
24
  def prx_auth_token
@@ -30,8 +30,8 @@ module PrxAuth
30
30
  nil
31
31
  end
32
32
 
33
- def set_after_sign_in_path
34
- session[PRX_REFRESH_BACK_KEY] = request.fullpath
33
+ def set_after_sign_in_path(path = nil)
34
+ session[PRX_REFRESH_BACK_KEY] = path || request.fullpath
35
35
  end
36
36
 
37
37
  def prx_jwt
@@ -44,6 +44,7 @@ module PrxAuth
44
44
 
45
45
  def authenticate!
46
46
  if !current_user
47
+ set_after_sign_in_path
47
48
  redirect_to new_sessions_path
48
49
  elsif !current_user_access?
49
50
  redirect_to access_error_sessions_path
@@ -0,0 +1,16 @@
1
+ module ActionDispatch
2
+ module Routing
3
+ class Mapper
4
+ def prx_auth_routes(path: "auth")
5
+ scope module: "prx_auth/rails", path: path do
6
+ resource "sessions", except: %w[edit update] do
7
+ get "access_error", to: "sessions#access_error"
8
+ get "auth_error", to: "sessions#auth_error"
9
+ get "logout", to: "sessions#logout"
10
+ get "refresh", to: "sessions#refresh"
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module PrxAuth
4
4
  module Rails
5
- VERSION = "5.0.1"
5
+ VERSION = "5.1.1"
6
6
  end
7
7
  end
@@ -2,6 +2,7 @@ require "prx_auth/rails/version"
2
2
  require "prx_auth/rails/configuration"
3
3
  require "prx_auth/rails/railtie" if defined?(Rails)
4
4
  require "prx_auth/rails/engine" if defined?(Rails)
5
+ require "prx_auth/rails/routes" if defined?(Rails)
5
6
 
6
7
  module PrxAuth
7
8
  module Rails
@@ -27,7 +28,7 @@ module PrxAuth
27
28
  host = configuration.id_host
28
29
  path = configuration.cert_path
29
30
  protocol =
30
- if host.include?("localhost") || host.include?("127.0.0.1")
31
+ if host&.include?("localhost") || host&.include?("127.0.0.1")
31
32
  "http"
32
33
  else
33
34
  "https"
@@ -1,4 +1,5 @@
1
1
  Rails.application.routes.draw do
2
+ prx_auth_routes
2
3
  get "index", to: "application#index"
3
4
  put "index", to: "application#index"
4
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prx_auth-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.1
4
+ version: 5.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Rhoden
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-04-08 00:00:00.000000000 Z
10
+ date: 2025-05-13 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: actionpack
@@ -212,7 +212,6 @@ files:
212
212
  - app/views/prx_auth/rails/sessions/auth_error.html.erb
213
213
  - app/views/prx_auth/rails/sessions/show.html.erb
214
214
  - config/initializers/assets.rb
215
- - config/routes.rb
216
215
  - lib/prx_auth/rails.rb
217
216
  - lib/prx_auth/rails/configuration.rb
218
217
  - lib/prx_auth/rails/engine.rb
@@ -220,6 +219,7 @@ files:
220
219
  - lib/prx_auth/rails/ext/controller/account_info.rb
221
220
  - lib/prx_auth/rails/ext/controller/user_info.rb
222
221
  - lib/prx_auth/rails/railtie.rb
222
+ - lib/prx_auth/rails/routes.rb
223
223
  - lib/prx_auth/rails/token.rb
224
224
  - lib/prx_auth/rails/version.rb
225
225
  - prx_auth-rails.gemspec
data/config/routes.rb DELETED
@@ -1,10 +0,0 @@
1
- Rails.application.routes.draw do
2
- scope module: "prx_auth/rails", path: "auth" do
3
- resource "sessions", except: %w[edit update] do
4
- get "access_error", to: "sessions#access_error"
5
- get "auth_error", to: "sessions#auth_error"
6
- get "logout", to: "sessions#logout"
7
- get "refresh", to: "sessions#refresh"
8
- end
9
- end
10
- end