Skip to content

Using Authorization annotation in JAVA #1479

@kfirisrael

Description

@kfirisrael

Hi,

We've defined a yaml file with Swagger version 2.0 with the following security definitions:

securityDefinitions:
  UserNameSecurity:
    type: apiKey
    in: header
    name: X-API-USERNAME
  PasswordSecurity:
    type: apiKey
    in: header
    name: X-API-PASSWORD
  TenantSecurity:
    type: apiKey
    in: header
    name: X-API-TENANT
    
security:
- UserNameSecurity: []
- PasswordSecurity: []
- TenantSecurity: []

After compiling it using Swagger JAVA compiler version 2.2.3 we see the security labels as annotations in all the operation, but we can't access the values entered for them in the request header.
@io.swagger.annotations.Authorization(value = "PasswordSecurity"),
@io.swagger.annotations.Authorization(value = "TenantSecurity"),
@io.swagger.annotations.Authorization(value = "UserNameSecurity")

Do you know how can the apiKey values, supplied in the header, can be accessed in the generated code?

Thanks,
Kfir

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions