Build a ``WWW-Authenticate`` header for HTTP Basic Auth. Args: realm: Identifier of the protection space.
(realm: str)
| 483 | |
| 484 | |
| 485 | def build_www_authenticate_basic(realm: str) -> str: |
| 486 | """ |
| 487 | Build a ``WWW-Authenticate`` header for HTTP Basic Auth. |
| 488 | |
| 489 | Args: |
| 490 | realm: Identifier of the protection space. |
| 491 | |
| 492 | """ |
| 493 | # https://datatracker.ietf.org/doc/html/rfc7617#section-2 |
| 494 | realm = build_quoted_string(realm) |
| 495 | charset = build_quoted_string("UTF-8") |
| 496 | return f"Basic realm={realm}, charset={charset}" |
| 497 | |
| 498 | |
| 499 | _token68_re = re.compile(r"[A-Za-z0-9-._~+/]+=*") |
searching dependent graphs…