shakha 0.1.4 → 0.1.6
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/app/controllers/shakha/application_controller.rb +0 -1
- data/app/controllers/shakha/auth_controller.rb +4 -1
- data/app/controllers/shakha/session_controller.rb +2 -5
- data/lib/shakha/auditable.rb +4 -4
- data/lib/shakha/rate_limiter.rb +1 -1
- data/lib/shakha/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 111afb5f4917b2fb01033e9b93c37fabc0b099a886c7cce7eb80d4485e69e9a1
|
|
4
|
+
data.tar.gz: '008356dd3f1538432a84ff2e83c2b6d32e3ec5962ed252c79c8dc3229677c16d'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 369843a745888523d8d3392e1111804d7113247005654de91c2fc75436a5a799ea505ad20858dbc057f9e81f5f3179dcaec77cd084923f3a1ae0121bcdb45960
|
|
7
|
+
data.tar.gz: 8bb91783e33cbac949565f21abded2d958b652b95f62b62f3d51eaabeaaf979224163376c98e58d25ecae57fbd41556f4a0db7c2415316e24e3778700e06af1e
|
|
@@ -6,6 +6,7 @@ require "uri"
|
|
|
6
6
|
module Shakha
|
|
7
7
|
class AuthController < ApplicationController
|
|
8
8
|
include PKCEMixin
|
|
9
|
+
include Auditable
|
|
9
10
|
|
|
10
11
|
skip_before_action :verify_authenticity_token, only: [:callback, :token]
|
|
11
12
|
|
|
@@ -177,7 +178,9 @@ module Shakha
|
|
|
177
178
|
session_record = Shakha::Session.create!(
|
|
178
179
|
user: user,
|
|
179
180
|
client: client,
|
|
180
|
-
jti: SecureRandom.uuid
|
|
181
|
+
jti: SecureRandom.uuid,
|
|
182
|
+
ip_address: request.remote_ip,
|
|
183
|
+
user_agent: request.user_agent
|
|
181
184
|
)
|
|
182
185
|
|
|
183
186
|
cookies.encrypted[:shakha_session_token] = {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Shakha
|
|
4
4
|
class SessionController < ApplicationController
|
|
5
|
+
include Auditable
|
|
5
6
|
skip_before_action :verify_authenticity_token, only: [:check]
|
|
6
7
|
|
|
7
8
|
def index
|
|
@@ -61,11 +62,7 @@ module Shakha
|
|
|
61
62
|
|
|
62
63
|
cookies.delete(:shakha_session_token) if session.token == current_session&.token
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
session_id: session.id,
|
|
66
|
-
user_id: current_user.id,
|
|
67
|
-
ip: request.remote_ip
|
|
68
|
-
})
|
|
65
|
+
log_session_revoked(session)
|
|
69
66
|
|
|
70
67
|
render json: { status: "revoked" }
|
|
71
68
|
end
|
data/lib/shakha/auditable.rb
CHANGED
|
@@ -5,15 +5,15 @@ module Shakha
|
|
|
5
5
|
extend ActiveSupport::Concern
|
|
6
6
|
|
|
7
7
|
included do
|
|
8
|
-
after_action :log_sign_in
|
|
9
|
-
after_action :log_sign_out
|
|
10
|
-
after_action :log_token_exchange
|
|
8
|
+
after_action :log_sign_in
|
|
9
|
+
after_action :log_sign_out
|
|
10
|
+
after_action :log_token_exchange
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
private
|
|
14
14
|
|
|
15
15
|
def log_sign_in
|
|
16
|
-
return unless response.successful? && @current_user
|
|
16
|
+
return unless action_name == "callback" && response.successful? && @current_user
|
|
17
17
|
|
|
18
18
|
ActiveSupport::Notifications.instrument("shakha.sign_in", {
|
|
19
19
|
user_id: @current_user&.id,
|
data/lib/shakha/rate_limiter.rb
CHANGED
data/lib/shakha/version.rb
CHANGED