Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic Auth is broken when using non-ASCII characters #7467

Open
Anastasiyaaa opened this issue Aug 19, 2021 · 0 comments
Open

Basic Auth is broken when using non-ASCII characters #7467

Anastasiyaaa opened this issue Aug 19, 2021 · 0 comments

Comments

@Anastasiyaaa
Copy link

Anastasiyaaa commented Aug 19, 2021

Q&A (please complete the following information)

  • OS: Window
  • Browser: Chrome
  • Version: 92.0.4515.159
  • Method of installation: dist assets
  • Swagger-UI version: 3.41
  • Swagger/OpenAPI version: OpenAPI 3.0.1

Content & configuration

Example Swagger/OpenAPI definition:

components:
  securitySchemes:
    Basic: 
      type: "http" 
      scheme: "basic"
    Security_Token: 
      type: "http"
      description: "Access Key:Secret Key"
      scheme: "bearer"
openapi: "3.0.1"
info:
  version: '3'
  title: test
  description: example for Auth
paths:
  /something:
    post:
      summary: Auth test
      responses:
        201:
          content:
            text/plain:
              schema:
                type: "string"
          description: "Created"
        401:
          content:
            text/plain:
              schema: 
                type: "string"
          description: "Authorization failed"
      security: [{Basic: []}, {Security_Token: []}]

Swagger-UI configuration options:

SwaggerUIBondle({
  dom_id: '#swagger-ui',
  deepLinking: true,
  presets: [
    SwaggerUIBundle.presets.apis,
    SwaggerUIStandalonePreset
  ],
  plugins: [
     SwaggerUIBundle.plugins.DownloadUrl
  ],
  layout: 'StandaloneLayout',
  defaultModelExpandDepth: "2",
  defaultModelsExpandDepth: "0",
  displayRequestDuration: "true",
  docExpansion: "none",
  oauth2RedirectUrl: "/swagger-ui/oauth2-redirect.html",
  operationsSorter: "method",
  tagsSorter: "alpha",
  tryItOutEnabled: "true",
  urls: [{url: "/api/docs/openapi/API v3", name: "API v3"}],
  validatorUrl: ""
})

Describe the bug you're encountering

Incorrect header if non-ASCII characters are used during authorize

To reproduce...

Steps to reproduce the behavior:

  1. Open (SwaggerEditor)[https://editor.swagger.io/] in chrome
  2. Paste the yaml file into the editor
  3. Click the 'Authorize' button
  4. Username: 'Ремонтник'
  5. Password: 'Ремонтник'
  6. Click the 'Authorize' button
  7. Click the 'Close' button
  8. Click the /something request
  9. Click the 'Try it out' button
  10. Click the 'Execute' button
  11. -H 'Authorization: Basic IDU8Pj1CPTg6OiA1PD49Qj04Og==' \

Expected behavior

-H 'Authorization: Basic 0KDQtdC80L7QvdGC0L3QuNC6OtCg0LXQvNC+0L3RgtC90LjQug=='\

Screenshots

image

Additional context or thoughts

Same problem: Issue 2456

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant