Replies: 3 comments
-
Hi, I'm not pretty sure if I understand correctly. You have parameter And what is the problem? Documentation isn't shown? Please can you provide demo and better describe the problem. Thanks. |
Beta Was this translation helpful? Give feedback.
-
Hi, Api gateway has bearer authentication configured for some routes, and from the token it extracts a claim and pass it in the header to downstream api (normal behaviour for Ocelot)
Since the auth is delegated to the gateway, the downstream rest api simply accepts a "user_id" header, and the generated swagger docs of the service shows it correctly. What I need to do is to manipulate the swagger docs in the Ocelot gateway to show the bearer token in place of the user_id header. This is because the client cannot pass in anyway the user_id directly. Thanks. |
Beta Was this translation helpful? Give feedback.
-
Hi, The quick answer is: this package offers nothing for it.
o.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme
{
Description = "Standard Authorization header using the Bearer scheme. Example: \"bearer {token}\"",
In = ParameterLocation.Header,
Name = "Authorization",
Type = SecuritySchemeType.ApiKey
}); Now your client can add token to Authorization UI and Gateway does his work.
I am sorry that I do not have a simple and clear solution. |
Beta Was this translation helpful? Give feedback.
-
Hi,
my gateway has bearer authentication configured for some routes, from which the user_id is extracted and passed to the downstream services via an header with the same name.
What's the correct way to get rid of the user_id header parameter and replace it with the bearer token, in the swagger documentation? Should I manipulate the json in ReConfigureUpstreamSwaggerJson? Any example?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions