Skip to content

Commit

Permalink
Merge pull request #56 from ransombriggs/fix-default-token
Browse files Browse the repository at this point in the history
Fix default token generation
  • Loading branch information
nbulaj authored Aug 8, 2024
2 parents df50f06 + d5b120a commit 57cbfb6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ project adheres to [Semantic Versioning](http://semver.org/).

## master

### Changed
### Fixed

- Fixed default token generation to return a random hex value [#56](https://github.com/doorkeeper-gem/doorkeeper-jwt/pull/56)

## [0.4.1] - 2022-02-23

Expand Down
2 changes: 1 addition & 1 deletion lib/doorkeeper/jwt/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def extended(base)

option(
:token_payload,
default: proc { { token: SecureRandom.method(:hex) } }
default: proc { { token: SecureRandom.hex } },
)

option :token_headers, default: proc { {} }
Expand Down
2 changes: 1 addition & 1 deletion spec/doorkeeper/jwt_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
decoded_token = ::JWT.decode(token, nil, false)

expect(decoded_token[0]).to be_a(Hash)
expect(decoded_token[0]["token"]).to be_a(String)
expect(decoded_token[0]["token"]).to match(/^\h{32}$/)
expect(decoded_token[1]).to be_a(Hash)
expect(decoded_token[1]["alg"]).to eq "none"
end
Expand Down

0 comments on commit 57cbfb6

Please sign in to comment.