Class: Yori::Schema::V3::SecurityScheme
- Inherits:
-
Yori::SchemaBase
- Object
- Hash
- Yori::SchemaBase
- Yori::Schema::V3::SecurityScheme
- Defined in:
- lib/yori/schema/v3/security_scheme.rb
Overview
SecurityScheme:
Defines a security scheme that can be used by the operations.
Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter),
OAuth2's common flows (implicit, password, application and access code) as defined in RFC6749, and OpenID Connect Discovery.
Instance Attribute Summary
Attributes inherited from Yori::SchemaBase
Instance Method Summary collapse
-
#bearerFormat(: AppliesTohttp("bearer")) ⇒ Object
A hint to the client to identify how the bearer token is formatted.
-
#description(: AppliesToAny;) ⇒ Object
A short description for security scheme.
-
#flows(: AppliesTooauth2;) ⇒ Object
REQUIRED.
- #in_cookie ⇒ Object
- #in_header ⇒ Object
- #in_query ⇒ Object
-
#name(: AppliesToapiKey;) ⇒ Object
REQUIRED.
-
#openIdConnectUrl(: AppliesToopenIdConnect) ⇒ Object
REQUIRED.
-
#scheme(: AppliesTohttp;) ⇒ Object
REQUIRED.
-
#type(: AppliesToAny;) ⇒ Object
REQUIRED.
- #validate! ⇒ Object
- #validate_as_api_key! ⇒ Object
- #validate_as_http! ⇒ Object
- #validate_as_oauth2! ⇒ Object
- #validate_as_open_id_connect! ⇒ Object
- #validate_type! ⇒ Object
Methods inherited from Yori::SchemaBase
eval_class!, eval_hash!, eval_input!, #ref, #validator
Instance Method Details
#bearerFormat(: AppliesTohttp("bearer")) ⇒ Object
A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes.
45 |
# File 'lib/yori/schema/v3/security_scheme.rb', line 45 fields :scheme, :bearerFormat |
#description(: AppliesToAny;) ⇒ Object
A short description for security scheme. CommonMark syntax MAY be used for rich text representation.
20 |
# File 'lib/yori/schema/v3/security_scheme.rb', line 20 fields :type, :description, :name |
#flows(: AppliesTooauth2;) ⇒ Object
REQUIRED. An object containing configuration information for the flow types supported.
49 |
# File 'lib/yori/schema/v3/security_scheme.rb', line 49 field_block :flows, Yori::Schema::V3::OAuthFlows |
#in_cookie ⇒ Object
36 37 38 |
# File 'lib/yori/schema/v3/security_scheme.rb', line 36 def self['in'] = 'cookie' end |
#in_header ⇒ Object
30 31 32 |
# File 'lib/yori/schema/v3/security_scheme.rb', line 30 def in_header self['in'] = 'header' end |
#in_query ⇒ Object
24 25 26 |
# File 'lib/yori/schema/v3/security_scheme.rb', line 24 def in_query self['in'] = 'query' end |
#name(: AppliesToapiKey;) ⇒ Object
REQUIRED. The name of the header, query or cookie parameter to be used.
20 |
# File 'lib/yori/schema/v3/security_scheme.rb', line 20 fields :type, :description, :name |
#openIdConnectUrl(: AppliesToopenIdConnect) ⇒ Object
REQUIRED. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL.
53 |
# File 'lib/yori/schema/v3/security_scheme.rb', line 53 fields :openIdConnectUrl |
#scheme(: AppliesTohttp;) ⇒ Object
REQUIRED. The name of the HTTP Authorization scheme to be used in the Authorization header as defined in RFC7235.
45 |
# File 'lib/yori/schema/v3/security_scheme.rb', line 45 fields :scheme, :bearerFormat |
#type(: AppliesToAny;) ⇒ Object
REQUIRED. The type of the security scheme. Valid values are “apiKey”, “http”, “oauth2”, “openIdConnect”
20 |
# File 'lib/yori/schema/v3/security_scheme.rb', line 20 fields :type, :description, :name |
#validate! ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/yori/schema/v3/security_scheme.rb', line 55 def validate! validate_type! case self['type'] when 'apiKey' validate_as_api_key! when 'http' validate_as_http! when 'oauth2' validate_as_oauth2! when 'openIdConnect' validate_as_open_id_connect! end end |
#validate_as_api_key! ⇒ Object
74 75 76 77 |
# File 'lib/yori/schema/v3/security_scheme.rb', line 74 def validate_as_api_key! validate_require_fields!('name', 'in') validate_limit_field_values!('in', 'query', 'header', 'cookie') end |
#validate_as_http! ⇒ Object
79 80 81 |
# File 'lib/yori/schema/v3/security_scheme.rb', line 79 def validate_as_http! validate_require_fields!('scheme') end |
#validate_as_oauth2! ⇒ Object
83 84 85 |
# File 'lib/yori/schema/v3/security_scheme.rb', line 83 def validate_as_oauth2! validate_require_fields!('flows') end |
#validate_as_open_id_connect! ⇒ Object
87 88 89 |
# File 'lib/yori/schema/v3/security_scheme.rb', line 87 def validate_as_open_id_connect! validate_require_fields!('openIdConnectUrl') end |
#validate_type! ⇒ Object
69 70 71 72 |
# File 'lib/yori/schema/v3/security_scheme.rb', line 69 def validate_type! validate_require_fields!('type') validate_limit_field_values!('type', 'apiKey', 'http', 'oauth2', 'openIdConnect') end |