Skip to content

Commit

Permalink
Refine revoked getter and improve enumeration
Browse files Browse the repository at this point in the history
Changed the `revoked` getter to a nilable type for consistent handling of null values in JSON serialization, avoiding potential bugs. Improved the `each` method in the in-memory JTI provider by utilizing block notation, simplifying code readability and maintainability. These enhancements streamline data handling and iteration in the codebase.
  • Loading branch information
eliasjpr committed Oct 8, 2024
1 parent 447dd79 commit 0a039cb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/authly/access_token.cr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Authly
getter access_token : String
getter token_type : String = "Bearer"
getter expires_in : Int64 = ACCESS_TTL.from_now.to_unix
getter revoked : Bool = false
getter? revoked : Bool = false
@[JSON::Field(emit_null: false)]
getter refresh_token : String
@[JSON::Field(emit_null: false)]
Expand Down
2 changes: 1 addition & 1 deletion src/authly/in_memory_jti_provider.cr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Authly
end

# Implement the each method to make the class enumerable
def each
def each(&)
@revoked_tokens.each { |jti| yield jti }
end

Expand Down

0 comments on commit 0a039cb

Please sign in to comment.