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).

Implements

Constructors

constructor

new SecurityScheme(properties?): SecurityScheme

Constructs a new SecurityScheme.

Parameters

NameTypeDescription
properties?ISecuritySchemeProperties to set

Returns

SecurityScheme

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.

Implementation of

ISecurityScheme.authorizationUrl


description

description: string

A short description for security scheme.

Implementation of

ISecurityScheme.description


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]: IValue

Implementation of

ISecurityScheme.extensions


flow

flow: Flow

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

Implementation of

ISecurityScheme.flow


in

in: In

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

Implementation of

ISecurityScheme.in


name

name: string

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

Implementation of

ISecurityScheme.name


scopes

Optional scopes: null | IScopes

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

Implementation of

ISecurityScheme.scopes


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.

Implementation of

ISecurityScheme.tokenUrl


type

type: Type

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

Implementation of

ISecurityScheme.type

Methods

toJSON

toJSON(): Object

Converts this SecurityScheme to JSON.

Returns

Object

JSON object


create

create(properties?): SecurityScheme

Creates a new SecurityScheme instance using the specified properties.

Parameters

NameTypeDescription
properties?ISecuritySchemeProperties to set

Returns

SecurityScheme

SecurityScheme instance


decode

decode(reader, length?): SecurityScheme

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

SecurityScheme

Throws

If the payload is not a reader or valid buffer

Throws

If required fields are missing


decodeDelimited

decodeDelimited(reader): SecurityScheme

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

Parameters

NameTypeDescription
readerUint8Array | ReaderReader or buffer to decode from

Returns

SecurityScheme

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
messageISecuritySchemeSecurityScheme 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
messageISecuritySchemeSecurityScheme 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


getTypeUrl

getTypeUrl(typeUrlPrefix?): string

Gets the default type url for SecurityScheme

Parameters

NameTypeDescription
typeUrlPrefix?stringyour custom typeUrlPrefix(default "type.googleapis.com")

Returns

string

The default type url


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