lib/matic-jwt/authenticator.rb in matic-jwt-0.2.3 vs lib/matic-jwt/authenticator.rb in matic-jwt-0.2.4

- old
+ new

@@ -1,9 +1,9 @@ module MaticJWT class Authenticator - def initialize(request) - @token = extract_token(request) + def initialize(headers) + @token = extract_token(headers) end def client_name payload.first['client_name'] end @@ -12,11 +12,11 @@ JWT.decode @token, secret, true, algorithm: ALGORITHM end private - def extract_token(request) - header = request.headers['Authorization'] + def extract_token(headers) + header = headers['Authorization'] validate_header_presence!(header) header.slice(8..-1) end def payload