class JwtRest::AuthHeader

Attributes

type[RW]
value[RW]

Public Class Methods

new(chunk = "") click to toggle source
# File lib/jwt_rest/auth_header.rb, line 3
def initialize(chunk = "")
  @type, @value = chunk&.split(" ")
  @type = @type&.downcase
end

Public Instance Methods

is_basic?() click to toggle source
# File lib/jwt_rest/auth_header.rb, line 8
def is_basic?
  type == "basic"
end
is_token?() click to toggle source
# File lib/jwt_rest/auth_header.rb, line 12
def is_token?
  type == "bearer"
end
token() click to toggle source
# File lib/jwt_rest/auth_header.rb, line 16
def token
  return JwtRest::Tokens::Basic.new(token: value).load_token if is_basic?
  return JwtRest::Tokens::Jwt.new(token: value).load_token if is_token?
end