note 129659 added to features.http-auth
| From: | pradeepkatiyar2000@gmail.com | Date: | Thu, 18 Jul 2024 05:26:07 +0000 |
| Subject: | note 129659 added to features.http-auth | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221430@lists.php.net to get a copy of this message | ||
Here's an example of Basic HTTP Authentication:
Scenario: Imagine a website with a protected area that only registered users can access.
User tries to access the protected area: The user's web browser sends a request to the server
for the protected resource.
Server challenges the request: The server recognizes the request is for a protected area and
hasn't received any authentication credentials yet. It responds with a status code 401
Unauthorized and a challenge in the WWW-Authenticate header. This challenge typically specifies the
authentication scheme (e.g., Basic) and might include a realm (a name identifying the protected
area).
User enters credentials: The user sees an authentication dialog in their browser. They enter their
username and password.
Browser builds the Authorization header: The browser combines the username and password with a colon
(":") separator and encodes them using Base64. This encoded string is then prefixed with
the scheme name "Basic " (with a space) to form the Authorization header value.
Browser sends the request again: The browser resends the request for the protected resource, this
time including the Authorization header with the Base64 encoded credentials.
Server validates credentials: The server receives the request with the Authorization header. It
extracts the username and password from the Base64 encoded string and checks them against its user
database.
Server grants access (or not): If the credentials are valid, the server grants access to the
protected resource and sends a normal successful response (e.g., status code 200 OK). Otherwise, it
sends another 401 Unauthorized response.
See our website: https://www.shoviv.com
Important points to remember:
Basic authentication transmits credentials in Base64 encoding, which is not a secure way of
encryption. It's best to use Basic authentication only over HTTPS connections to prevent
eavesdropping.
Basic authentication reveals usernames and passwords in cleartext on the server-side.
For secure authentication, consider using more sophisticated schemes like Digest authentication or
OAuth.
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.84.18 (proxied: 162.210.194.2)
----
Manual Page -- https://php.net/manual/en/features.http-auth.php
Edit -- https://main.php.net/note/edit/129659
Del: integrated -- https://main.php.net/note/delete/129659/integrated
Del: useless -- https://main.php.net/note/delete/129659/useless
Del: bad code -- https://main.php.net/note/delete/129659/bad+code
Del: spam -- https://main.php.net/note/delete/129659/spam
Del: non-english -- https://main.php.net/note/delete/129659/non-english
Del: in docs -- https://main.php.net/note/delete/129659/in+docs
Del: other reasons-- https://main.php.net/note/delete/129659
Reject -- https://main.php.net/note/reject/129659
Search -- https://main.php.net/manage/user-notes.php