Class: RubstApi::Security::Base
- Inherits:
-
Object
- Object
- RubstApi::Security::Base
- Defined in:
- lib/rubst_api/security.rb
Direct Known Subclasses
APIKeyCookie, APIKeyHeader, APIKeyQuery, HTTPBasic, HTTPBearer
Instance Attribute Summary collapse
-
#auto_error ⇒ Object
readonly
Returns the value of attribute auto_error.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#scheme_name ⇒ Object
readonly
Returns the value of attribute scheme_name.
Instance Method Summary collapse
- #fail_auth(detail = "Not authenticated") ⇒ Object
-
#initialize(scheme_name: nil, description: nil, auto_error: true) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(scheme_name: nil, description: nil, auto_error: true) ⇒ Base
Returns a new instance of Base.
15 16 17 18 |
# File 'lib/rubst_api/security.rb', line 15 def initialize(scheme_name: nil, description: nil, auto_error: true) @scheme_name = scheme_name || self.class.name.split("::").last @description, @auto_error = description, auto_error end |
Instance Attribute Details
#auto_error ⇒ Object (readonly)
Returns the value of attribute auto_error.
14 15 16 |
# File 'lib/rubst_api/security.rb', line 14 def auto_error @auto_error end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
14 15 16 |
# File 'lib/rubst_api/security.rb', line 14 def description @description end |
#scheme_name ⇒ Object (readonly)
Returns the value of attribute scheme_name.
14 15 16 |
# File 'lib/rubst_api/security.rb', line 14 def scheme_name @scheme_name end |
Instance Method Details
#fail_auth(detail = "Not authenticated") ⇒ Object
19 20 21 |
# File 'lib/rubst_api/security.rb', line 19 def fail_auth(detail = "Not authenticated") raise HTTPException.new(status_code: 401, detail:, headers: { "WWW-Authenticate" => scheme_name }) end |