You are here

public function OpenApiGeneratorBase::getSecurity in OpenAPI 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/openapi/OpenApiGeneratorBase.php \Drupal\openapi\Plugin\openapi\OpenApiGeneratorBase::getSecurity()

Returns a list of valid security types for the api.

Values of returned array will be empty, except for OAuth2 definitions, for which the required scopes should be returned.

Return value

array An array where keys correspond to a security scheme.

Overrides OpenApiGeneratorInterface::getSecurity

1 call to OpenApiGeneratorBase::getSecurity()
OpenApiGeneratorBase::getSpecification in src/Plugin/openapi/OpenApiGeneratorBase.php
Generates OpenAPI specification.

File

src/Plugin/openapi/OpenApiGeneratorBase.php, line 317

Class

OpenApiGeneratorBase
Defines base class for OpenApi Generator plugins.

Namespace

Drupal\openapi\Plugin\openapi

Code

public function getSecurity() {

  // @TODO: #2977109 - Calculate oauth scopes required.
  $security = [];
  foreach (array_keys($this
    ->getSecurityDefinitions()) as $method) {
    $security[$method] = [];
  }
  return $security;
}