Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Claims verification fixes #142

Merged
merged 1 commit into from
Sep 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions lib/jwt_sessions/authorization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ def request_method
end

def valid_csrf_token?(csrf_token, token_type)
JWTSessions::Session.new(claims).valid_csrf?(found_token, csrf_token, token_type)
JWTSessions::Session.new(session_claims).valid_csrf?(found_token, csrf_token, token_type)
end

def session_exists?(token_type)
JWTSessions::Session.new(claims).session_exists?(found_token, token_type)
JWTSessions::Session.new(session_claims).session_exists?(found_token, token_type)
end

def cookieless_auth(token_type)
Expand Down Expand Up @@ -151,10 +151,11 @@ def authorize_request(token_type)
check_csrf(token_type)
end

def claims
def session_claims
claims = respond_to?(:token_claims) ? token_claims : {}
{
access_claims: token_claims,
refresh_claims: token_claims
access_claims: claims,
refresh_claims: claims
}
end
end
Expand Down
Loading