Class: JwtRest::AuthHeader
- Inherits:
-
Object
- Object
- JwtRest::AuthHeader
- Defined in:
- lib/jwt_rest/auth_header.rb
Instance Method Summary collapse
-
#initialize(chunk = "") ⇒ AuthHeader
constructor
A new instance of AuthHeader.
- #is_basic? ⇒ Boolean
- #is_token? ⇒ Boolean
- #token ⇒ Object
Constructor Details
#initialize(chunk = "") ⇒ AuthHeader
Returns a new instance of AuthHeader.
3 4 5 6 |
# File 'lib/jwt_rest/auth_header.rb', line 3 def initialize(chunk = "") @type, @value = chunk.split(" ") @type = @type&.downcase end |
Instance Method Details
#is_basic? ⇒ Boolean
8 9 10 |
# File 'lib/jwt_rest/auth_header.rb', line 8 def is_basic? type == "basic" end |
#is_token? ⇒ Boolean
12 13 14 |
# File 'lib/jwt_rest/auth_header.rb', line 12 def is_token? type == "bearer" end |
#token ⇒ Object
16 17 18 19 |
# 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 |