lib/matic-jwt/authenticator.rb in matic-jwt-0.3.0 vs lib/matic-jwt/authenticator.rb in matic-jwt-1.0.0

- old
+ new

@@ -1,10 +1,9 @@ module MaticJWT class Authenticator - TOKEN_TYPE = 'Bearer: '.freeze - - def initialize(header) + def initialize(header, scheme: SCHEME) + @scheme = scheme @token = extract_token(header) end def client_name payload.first['client_name'] @@ -15,10 +14,10 @@ end private def extract_token(header) - token = header.slice(TOKEN_TYPE.length..-1) + token = header.slice(@scheme.length + 1..-1) validate_header_presence!(token) token end def payload