Skip to main content

Class: SecurityScheme

protoc_gen_openapiv2.options.SecurityScheme

SecurityScheme is a representation of OpenAPI v2 specification's Security Scheme object.

See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securitySchemeObject

Allows the definition of a security scheme that can be used by the operations. Supported schemes are basic authentication, an API key (either as a header or as a query parameter) and OAuth2's common flows (implicit, password, application and access code).

Properties​

authorizationUrl​

• authorizationUrl: string

The authorization URL to be used for this flow. This SHOULD be in the form of a URL. Valid for oauth2/implicit and oauth2/accessCode.


description​

• description: string

A short description for security scheme.


extensions​

• extensions: Object

Custom properties that start with "x-" such as "x-foo" used to describe extra functionality that is not covered by the standard OpenAPI Specification. See: https://swagger.io/docs/specification/2-0/swagger-extensions/

Index signature​

▪ [k: string]: $Properties


flow​

• flow: Flow

The flow used by the OAuth2 security scheme. Valid values are "implicit", "password", "application" or "accessCode". Valid for oauth2.


in​

• in: In

The location of the API key. Valid values are "query" or "header". Valid for apiKey.


name​

• name: string

The name of the header or query parameter to be used. Valid for apiKey.


scopes​

• Optional scopes: null | $Properties

The available scopes for the OAuth2 security scheme. Valid for oauth2.


tokenUrl​

• tokenUrl: string

The token URL to be used for this flow. This SHOULD be in the form of a URL. Valid for oauth2/password, oauth2/application and oauth2/accessCode.


type​

• type: Type

The type of the security scheme. Valid values are "basic", "apiKey" or "oauth2".

Methods​

toJSON​

▸ toJSON(): Object

Converts this SecurityScheme to JSON.

Returns​

Object

JSON object


create​

▸ create(properties?): SecurityScheme & $Shape

Creates a new SecurityScheme instance using the specified properties.

Parameters​

NameTypeDescription
properties?$ShapeProperties to set

Returns​

SecurityScheme & $Shape

SecurityScheme instance

▸ create(properties?): SecurityScheme

Parameters​

NameType
properties?$Properties

Returns​

SecurityScheme


decode​

▸ decode(reader, length?): SecurityScheme & $Shape

Decodes a SecurityScheme message from the specified reader or buffer.

Parameters​

NameTypeDescription
readerUint8Array | ReaderReader or buffer to decode from
length?numberMessage length if known beforehand

Returns​

SecurityScheme & $Shape

SecurityScheme

Throws

If the payload is not a reader or valid buffer

Throws

If required fields are missing


decodeDelimited​

▸ decodeDelimited(reader): SecurityScheme & $Shape

Decodes a SecurityScheme message from the specified reader or buffer, length delimited.

Parameters​

NameTypeDescription
readerUint8Array | ReaderReader or buffer to decode from

Returns​

SecurityScheme & $Shape

SecurityScheme

Throws

If the payload is not a reader or valid buffer

Throws

If required fields are missing


encode​

▸ encode(message, writer?): Writer

Encodes the specified SecurityScheme message. Does not implicitly grpc.gateway.protoc_gen_openapiv2.options.SecurityScheme.verify|verify messages.

Parameters​

NameTypeDescription
message$PropertiesSecurityScheme message or plain object to encode
writer?WriterWriter to encode to

Returns​

Writer

Writer


encodeDelimited​

▸ encodeDelimited(message, writer?): Writer

Encodes the specified SecurityScheme message, length delimited. Does not implicitly grpc.gateway.protoc_gen_openapiv2.options.SecurityScheme.verify|verify messages.

Parameters​

NameTypeDescription
message$PropertiesSecurityScheme message or plain object to encode
writer?WriterWriter to encode to

Returns​

Writer

Writer


fromObject​

▸ fromObject(object): SecurityScheme

Creates a SecurityScheme message from a plain object. Also converts values to their respective internal types.

Parameters​

NameTypeDescription
objectObjectPlain object

Returns​

SecurityScheme

SecurityScheme


toObject​

▸ toObject(message, options?): Object

Creates a plain object from a SecurityScheme message. Also converts values to other types if specified.

Parameters​

NameTypeDescription
messageSecuritySchemeSecurityScheme
options?IConversionOptionsConversion options

Returns​

Object

Plain object