Class: Jsapi::Meta::SecurityScheme::HTTP::Bearer

Inherits:
Base show all
Includes:
OpenAPI::Extensions
Defined in:
lib/jsapi/meta/security_scheme/http/bearer.rb

Overview

Specifies a security scheme based on bearer authentication.

Note that Bearer authentication was introduced with OpenAPI 3.0. Thus, a security scheme of this class is omitted when generating an OpenAPI 2.0 document.

Instance Method Summary collapse

Methods included from OpenAPI::Extensions

included

Methods inherited from Base

#deprecated, #description

Methods inherited from Model::Base

#initialize, #inspect, #merge!, #reference?, #resolve

Methods included from Model::Attributes

#attributes_frozen?, #freeze_attributes, included

Constructor Details

This class inherits a constructor from Jsapi::Meta::Model::Base

Instance Method Details

#bearer_formatObject

:attr: bearer_format The format of the bearer token.



17
# File 'lib/jsapi/meta/security_scheme/http/bearer.rb', line 17

attribute :bearer_format, String

#to_openapi(version) ⇒ Object

Returns a hash representing the OpenAPI security scheme object, or nil if version is less than OpenAPI 3.0.



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/jsapi/meta/security_scheme/http/bearer.rb', line 21

def to_openapi(version, *)
  version = OpenAPI::Version.from(version)
  return if version < OpenAPI::V3_0

  openapi_security_scheme_object(
    'http',
    version,
    scheme: 'bearer',
    bearerFormat: bearer_format
  )
end