swagger-api / swagger-ui

Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
https://swagger.io
Apache License 2.0
26.59k stars 8.96k forks source link

How to change text present on swagger authorization screen using springdoc #6340

Open SSK-code opened 4 years ago

SSK-code commented 4 years ago

I want to change the Authorized label to Stored.

Please find the below screenshot from swagger UI authorization screen

image

The reason I want to change it as it is miss leading. If the user passes an invalid credential still it is showing as authorized.

Actual validation of Username and password is happening once we execute the request.

I am also good if anyone has an answer to validate the credentials once we hit the Authorize button as shown below.

Same question is asked on StackOverflow here

enggsatyamraj commented 1 year ago

Can i work on it @tim-lai I am currently looking into this issuse, where can I find this template or this section. I am not getting it

XprabhatX commented 1 year ago

Hey I solved this issue. Can you assign it to me? @tim-lai image

SSK-code commented 1 year ago

@XprabhatX You can work on it.

XprabhatX commented 1 year ago

I have made my pull request. @SSK-code

char0n commented 12 months ago

We have currently three different auth types that use Authorized label:

If we're going to change the label, it must be done in systematic way.

IMHO Basic, API Key and OAuth2 types shared the same mechanism - store credentials for later use while executing requests. So in that context, I would argue that if we're changing the Authorized label, we should change it in all three cases. To elaborate further - what would be the real value of changing Authorized to Stored? Yes, from the perspective of authorization/authentication we're storing the credentials, but from the perspective of SwaggerUI we're authorizing/authenticating the future requests - and everybody would understand what that means, instead of displaying Stored label, which might be more confusing.

ponelat commented 12 months ago

Thanks folks,

Stored is fine as a term there. As long as the button used to "store" them remain "Authorized", to support the oAuth2 flow that opens a new browser tab to grab the (implicit) token. But the term used on the modal, can be "Stored" for all cases.

char0n commented 12 months ago

After discussing with @ponelat, we're open to the following systematic solution:

Basic - button (Store), label(Store) API Key - button (Store), label(Store) OAuth2 - button (Authorize), label(Store)

@XprabhatX would you mind incorporating that into your PR?

XprabhatX commented 12 months ago

@char0n Sure I am on it.