-
Notifications
You must be signed in to change notification settings - Fork 8k
/
index.md
54 lines (40 loc) · 2.69 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
---
title: Authorization
slug: Web/HTTP/Headers/Authorization
---
{{HTTPSidebar}}
La cabecera de petición **`Authorization`** contiene las credenciales para autenticar a un usuario en un servidor, usualmente luego de que el servidor haya respondido con un estado {{HTTPStatus("401")}} `Unauthorized` y la cabecera {{HTTPHeader("WWW-Authenticate")}}.
| Tipo de cabecera | {{Glossary("Cabecera de respuesta")}} |
| ---------------------------------------------- | ------------------------------------- |
| {{Glossary("Nombre de encabezado prohibido")}} | No |
## Sintaxis
```
Authorization: <tipo> <credenciales>
```
## Directivas
- \<tipo>
- : [Tipo de Autenticación](/es/docs/Web/HTTP/Authentication#Authentication_schemes). Un tipo común es ["Basic"](/es/docs/Web/HTTP/Authentication#Basic_authentication_scheme). Otros tipos:
- [IANA registry of Authentication schemes](http://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml)
- [Authentification for AWS servers (`AWS4-HMAC-SHA256`)](http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-auth-using-authorization-header.html)
- \<credenciales>
- : Si se utiliza el esquema de la autenticación "Basic", las credenciales son construidas de esta forma:
- El usuario y la contraseña se combinan con dos puntos (`aladdin:opensesame`).
- El string resultante está basado en la codificación [base64](/es/docs/Web/API/WindowBase64/Base64_encoding_and_decoding) (`YWxhZGRpbjpvcGVuc2VzYW1l`).
> [!NOTE]
> ¡La codificación Base64 no es equivalente a encriptación o hashing! Este método es igual de seguro a enviar las credenciales en un archivo plano de texto (la codificación base64 es reversible). Lo recomendable es utilizar HTTPS en conjunto a la autenticación básica.
## Ejemplos
```
Authorization: Basic YWxhZGRpbjpvcGVuc2VzYW1l
```
Ver también [HTTP authentication](/es/docs/Web/HTTP/Authentication) para ejemplos sobre cómo configurar servidores Apache o nginx para proteger su sitio con contraseña usando la autenticación básica HTTP.
## Especificaciones
| Especificación | Título |
| --------------------------------------- | -------------------------------------- |
| {{RFC("7235", "Authorization", "4.2")}} | HTTP/1.1: Authentication |
| {{RFC("7617")}} | The 'Basic' HTTP Authentication Scheme |
## Ver también
- [HTTP authentication](/es/docs/Web/HTTP/Authentication)
- {{HTTPHeader("WWW-Authenticate")}}
- {{HTTPHeader("Proxy-Authorization")}}
- {{HTTPHeader("Proxy-Authenticate")}}
- {{HTTPStatus("401")}}, {{HTTPStatus("403")}}, {{HTTPStatus("407")}}