Class: Keycard::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/keycard/token.rb

Overview

Holds utility methods for parsing tokens from header values

Constant Summary collapse

TOKEN_DELIMS =
/\s*[:,;\t]\s*/.freeze

Class Method Summary collapse

Class Method Details

.rfc7235(string) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/keycard/token.rb', line 8

def rfc7235(string)
  string
    .sub(/^(Bearer|Token):?/, '')
    .split(TOKEN_DELIMS)
    .map { |assignment| split_assignment(assignment) }
    .to_h["token"]
end