Skip to content

Commit

Permalink
Merge pull request #140 from tuwukee/jwt-2.9-version-support
Browse files Browse the repository at this point in the history
Add jwt 2.9 support
  • Loading branch information
tuwukee authored Sep 18, 2024
2 parents ea829dc + 4e7c412 commit 59a1534
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 22 deletions.
14 changes: 5 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,11 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ['3.1', '3.2', '3.3']
rails: ['6.0', '6.1', '7.0']
exclude:
- ruby: '3.1'
rails: '6.0'
- ruby: '3.2'
rails: '6.0'
- ruby: '3.3'
rails: '6.0'
ruby: ['3.3']
rails: ['6.1', '7.0']
# exclude:
# - ruby: '3.1'
# rails: '6.0'

name: Ruby ${{ matrix.ruby }} Rails ${{ matrix.rails }} run

Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 3.2.3 (Septemper 18, 2024)

Support:

- add support for `jwt` to 2.9 version

## 3.2.2 (March 5, 2024)

Support:
Expand Down
4 changes: 2 additions & 2 deletions jwt_sessions.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require "jwt_sessions/version"
Gem::Specification.new do |s|
s.name = "jwt_sessions"
s.version = JWTSessions::VERSION
s.date = "2024-03-05"
s.date = "2024-09-18"
s.summary = "JWT Sessions"
s.description = "XSS/CSRF safe JWT auth designed for SPA"
s.authors = ["Julija Alieckaja"]
Expand All @@ -26,7 +26,7 @@ Gem::Specification.new do |s|
"bug_tracker_uri" => "https://github.com/tuwukee/jwt_sessions/issues"
}

s.add_dependency "jwt", ">= 2.8", "< 3"
s.add_dependency "jwt", ">= 2.9", "< 3"

s.add_development_dependency "bundler", ">= 2"
s.add_development_dependency "rake", "~> 13.1"
Expand Down
10 changes: 2 additions & 8 deletions lib/jwt_sessions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ def jwt_options
end

def algorithm=(algo)
raise Errors::Malconfigured, "algorithm #{algo} is not supported" unless supported_algos.include?(algo)
raise Errors::Malconfigured, "algorithm #{algo} is not supported" unless JWT::JWA.resolve(algo)

@algorithm = algo
end

Expand Down Expand Up @@ -151,11 +152,4 @@ def header_by(token_type)
def cookie_by(token_type)
send("#{token_type}_cookie")
end

private

def supported_algos
algos = JWT::JWA::ALGOS - [JWT::JWA::Unsupported]
algos.map { |algo| algo::SUPPORTED }.flatten + [NONE]
end
end
2 changes: 1 addition & 1 deletion lib/jwt_sessions/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module JWTSessions
VERSION = "3.2.2"
VERSION = "3.2.3"
end
6 changes: 4 additions & 2 deletions test/support/dummy_api/config/initializers/jwt_sessions.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
JWTSessions.algorithm = "HS256"
JWTSessions.signing_key = Rails.application.secrets.secret_key_base
# frozen_string_literal: true

JWTSessions.algorithm = 'HS256'
JWTSessions.signing_key = 'super-secret-key'
JWTSessions.token_store = ENV['STORE_ADAPTER'] || 'redis'

0 comments on commit 59a1534

Please sign in to comment.