Class: Jsapi::Controller::Authentication::Credentials::HTTP::Bearer

Inherits:
Base
  • Object
show all
Defined in:
lib/jsapi/controller/authentication/credentials/http/bearer.rb

Overview

Holds a token passed according to HTTP Bearer Authentication.

Instance Attribute Summary collapse

Attributes inherited from Base

#auth_param, #auth_scheme

Instance Method Summary collapse

Constructor Details

#initialize(authorization) ⇒ Bearer

Returns a new instance of Bearer.



15
16
17
18
19
20
# File 'lib/jsapi/controller/authentication/credentials/http/bearer.rb', line 15

def initialize(authorization)
  super
  @token =
    Base64.decode64(auth_param) \
    if auth_scheme == 'Bearer' && auth_param.present?
end

Instance Attribute Details

#tokenObject (readonly)

The decoded token.



13
14
15
# File 'lib/jsapi/controller/authentication/credentials/http/bearer.rb', line 13

def token
  @token
end

Instance Method Details

#well_formed?Boolean

:nodoc:

Returns:

  • (Boolean)


22
23
24
# File 'lib/jsapi/controller/authentication/credentials/http/bearer.rb', line 22

def well_formed? # :nodoc:
  !token.nil?
end