Herry
5 years agoNew Member
Swagger 2.0 apiKey authentication and scopes
Hi community,
I use this security definition in our project:
securityDefinitions:
JwtBearerAuth:
type: apiKey
name: Authorization
in: header
x-apikeyInfoFunc: "services.token_service.verifyToken"
with the following endpoint:
paths:
/secret:
get:
security:
- JwtBearerAuth: []
operationId: "rest.user.secret"
tags:
- "User"
summary: "Testpage for authentication"
description: "Should only be accessible with a valid JWT token in the 'authorization' header"
responses:
'200':
description: "OK"
'401':
description: "No or an invalid token was provided"
and I wanted to ask what the best way is, to achieve a form of role-management. For example i want to add the role-information in my endpoint, like roles: ["admin"]. Is this possible with this configuration?
Best Regards