Class: Spikard::SecuritySchemeInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/spikard/config.rb

Overview

Security scheme configuration for OpenAPI documentation.

Supports HTTP (Bearer/JWT) and API Key authentication schemes.

Examples:

HTTP Bearer

scheme = SecuritySchemeInfo.new(
  type: 'http',
  scheme: 'bearer',
  bearer_format: 'JWT'
)

API Key

scheme = SecuritySchemeInfo.new(
  type: 'apiKey',
  location: 'header',
  name: 'X-API-Key'
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, scheme: nil, bearer_format: nil, location: nil, name: nil) ⇒ SecuritySchemeInfo

Returns a new instance of SecuritySchemeInfo.

Parameters:

  • type (String)

    Security scheme type (“http” or “apiKey”)

  • scheme (String, nil) (defaults to: nil)

    HTTP scheme (e.g., “bearer”, “basic”) - for type=“http”

  • bearer_format (String, nil) (defaults to: nil)

    Format hint for Bearer tokens (e.g., “JWT”) - for type=“http”

  • location (String, nil) (defaults to: nil)

    Where to look for the API key (“header”, “query”, or “cookie”) - for type=“apiKey”

  • name (String, nil) (defaults to: nil)

    Parameter name (e.g., “X-API-Key”) - for type=“apiKey”



221
222
223
224
225
226
227
228
229
# File 'lib/spikard/config.rb', line 221

def initialize(type:, scheme: nil, bearer_format: nil, location: nil, name: nil)
  @type = type
  @scheme = scheme
  @bearer_format = bearer_format
  @location = location
  @name = name

  validate!
end

Instance Attribute Details

#bearer_formatObject

Returns the value of attribute bearer_format.



214
215
216
# File 'lib/spikard/config.rb', line 214

def bearer_format
  @bearer_format
end

#locationObject

Returns the value of attribute location.



214
215
216
# File 'lib/spikard/config.rb', line 214

def location
  @location
end

#nameObject

Returns the value of attribute name.



214
215
216
# File 'lib/spikard/config.rb', line 214

def name
  @name
end

#schemeObject

Returns the value of attribute scheme.



214
215
216
# File 'lib/spikard/config.rb', line 214

def scheme
  @scheme
end

#typeObject

Returns the value of attribute type.



214
215
216
# File 'lib/spikard/config.rb', line 214

def type
  @type
end