authkeeper 0.1.6 → 0.1.7

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: d7e3d45ae7bcca438a4237c560263cba833d3d41c9dae190345f9fb45851a2ba
4
- data.tar.gz: 13a0894bf0629edc822a341a150e34868f11e1bea9ea8716cf83ac75295ec3b2
3
+ metadata.gz: 4df1a975a6ed32b2e3c7a1c7371796e8112db93c7fe74cac15a7aaf7bb8d3d21
4
+ data.tar.gz: 65d219ac4b2d153c3846dd4c70a9cacb5798ba6c41b2aea76ab9e749c61138e1
5
5
  SHA512:
6
- metadata.gz: 4f5f3223c51f25c51e54949b84c3cf4485f8337f22956bb9170b61bb219508ae68fb5b9087ab64dee59bed0d1d93c3835f754217c88024a2d4bf893106ca0e0f
7
- data.tar.gz: 6f62a8506fd37f9bcaf8240629ef027d78406f8df2535021994a36b289700b55e8ab985feba0001cce11731f96137be904ac8e51139f39a1076a07a9011a49b8
6
+ metadata.gz: bb12a72dbace108366d05d6051183dbe651bbc0e92eb5d8365bdec4f5e5d1b23b110cf8c3c9880e4ea1415be7a7331241f1bd7fef776197c811196852ae79e0e
7
+ data.tar.gz: d9db1df5121f1c583f94a74c97915038bc0ae3154a775adb7e8abe11649134bc9951ada4b975d50a91a65aacb944f1eb1e93e25eeb3bfd06dc24a89041fdf680
@@ -3,7 +3,6 @@
3
3
  module Authkeeper
4
4
  class JwtEncoder
5
5
  HMAC_SECRET = Rails.application.secret_key_base
6
- EXPIRATION_SECONDS = 604_800 # 1.week
7
6
 
8
7
  def encode(payload:, secret: HMAC_SECRET)
9
8
  JWT.encode(modify_payload(payload), secret)
@@ -18,8 +17,14 @@ module Authkeeper
18
17
  def modify_payload(payload)
19
18
  payload.merge!(
20
19
  random: SecureRandom.hex,
21
- exp: DateTime.now.to_i + EXPIRATION_SECONDS
20
+ exp: DateTime.now.to_i + token_expiration_seconds
22
21
  )
23
22
  end
23
+
24
+ private
25
+
26
+ def token_expiration_seconds
27
+ @token_expiration_seconds ||= Authkeeper.configuration.token_expiration_seconds
28
+ end
24
29
  end
25
30
  end
@@ -5,6 +5,7 @@ module Authkeeper
5
5
  InitializeError = Class.new(StandardError)
6
6
 
7
7
  attr_accessor :user_model, :user_session_model, :access_token_name, :domain, :fallback_url_session_name, :omniauth_providers
8
+ :token_expiration_seconds
8
9
  attr_reader :omniauth_configs
9
10
 
10
11
  def initialize
@@ -17,6 +18,8 @@ module Authkeeper
17
18
 
18
19
  @omniauth_providers = []
19
20
  @omniauth_configs = {}
21
+
22
+ @token_expiration_seconds = 18_144_000 # 30.days
20
23
  end
21
24
 
22
25
  def validate
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Authkeeper
4
- VERSION = '0.1.6'
4
+ VERSION = '0.1.7'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authkeeper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bogdanov Anton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-02 00:00:00.000000000 Z
11
+ date: 2025-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails