Class: Jsapi::Controller::Authentication::Credentials::HTTP::Base

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

Overview

Holds credentials passed according to HTTP Authentication.

Direct Known Subclasses

Basic, Bearer

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(authorization) ⇒ Base

Returns a new instance of Base.



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

def initialize(authorization)
  @auth_scheme, @auth_param = authorization.to_s.split(' ', 2)
end

Instance Attribute Details

#auth_paramObject (readonly)

Returns the value of attribute auth_param.



10
11
12
# File 'lib/jsapi/controller/authentication/credentials/http/base.rb', line 10

def auth_param
  @auth_param
end

#auth_schemeObject (readonly)

Returns the value of attribute auth_scheme.



10
11
12
# File 'lib/jsapi/controller/authentication/credentials/http/base.rb', line 10

def auth_scheme
  @auth_scheme
end

Instance Method Details

#well_formed?Boolean

Returns true if the credentials are syntactically correct.

Returns:

  • (Boolean)


17
18
19
# File 'lib/jsapi/controller/authentication/credentials/http/base.rb', line 17

def well_formed?
  auth_scheme.present? && auth_param.present?
end