-
-
Notifications
You must be signed in to change notification settings - Fork 545
-
May a stupid question but I can't find a docu or howto or something.
I have already this:
@Configuration
class OpenApiConfiguration {
@Bean
OpenAPI customOpenAPI(final CadWebServiceProperties properties) {
return new OpenAPI()
.components(
new Components()
.addSecuritySchemes("apiKey",
new SecurityScheme().type(APIKEY).in(In.HEADER).name(properties.authTokenHeaderName())));
}
}
I can use the schema in swagger ui:
But then when I send requests ... the header is not in requests. I checked with chrome network console.
Where is the missing magic?
Kind regards
Andreas
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 2 comments
-
We used something like this and it works:
`@Configuration
public class SwaggerConfiguration {
public static final String SEC_SCHEME_NAME = "Access Token";
@Bean
public OpenAPI openAPI() {
return new OpenAPI()
.components(new Components().addSecuritySchemes(SEC_SCHEME_NAME, securityScheme()))
.addSecurityItem(new SecurityRequirement().addList(SEC_SCHEME_NAME));
}
private SecurityScheme securityScheme() {
return new SecurityScheme()
.type(SecurityScheme.Type.APIKEY)
.in(SecurityScheme.In.HEADER)
.name(AUTHORIZATION);
}
}`
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
0 replies
-
I will re-test this asap.
Beta Was this translation helpful? Give feedback.
All reactions
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment