Class: RubstApi::Security::HTTPBearer
- Defined in:
- lib/rubst_api/security.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Base
#auto_error, #description, #scheme_name
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from RubstApi::Security::Base
Instance Method Details
#call(request:) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/rubst_api/security.rb', line 25 def call(request:) scheme, credentials = request.headers["authorization"]&.split(" ", 2) return fail_auth unless scheme&.casecmp?("Bearer") && credentials HTTPAuthorizationCredentials.new(scheme, credentials) rescue HTTPException raise if auto_error nil end |
#openapi_scheme ⇒ Object
33 |
# File 'lib/rubst_api/security.rb', line 33 def openapi_scheme = { type: "http", scheme: "bearer", description: description }.compact |