Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / doc / radosgw / swift / auth.rst
1 ================
2  Authentication
3 ================
4
5 Swift API requests that require authentication must contain an
6 ``X-Storage-Token`` authentication token in the request header. 
7 The token may be retrieved from RADOS Gateway, or from another authenticator.
8 To obtain a token from RADOS Gateway, you must create a user. For example:: 
9
10     sudo radosgw-admin user create --subuser="{username}:{subusername}" --uid="{username}" 
11     --display-name="{Display Name}" --key-type=swift --secret="{password}" --access=full
12
13 For details on RADOS Gateway administration, see `radosgw-admin`_. 
14
15 .. _radosgw-admin: ../../../man/8/radosgw-admin/ 
16
17 Auth Get
18 --------
19
20 To authenticate a user, make a request containing an ``X-Auth-User`` and a
21 ``X-Auth-Key`` in the header.
22
23 Syntax
24 ~~~~~~
25
26 ::
27
28     GET /auth HTTP/1.1
29     Host: swift.radosgwhost.com
30     X-Auth-User: johndoe
31     X-Auth-Key: R7UUOLFDI2ZI9PRCQ53K
32
33 Request Headers
34 ~~~~~~~~~~~~~~~
35
36 ``X-Auth-User`` 
37
38 :Description: The key RADOS GW username to authenticate.
39 :Type: String
40 :Required: Yes
41
42 ``X-Auth-Key`` 
43
44 :Description: The key associated to a RADOS GW username.
45 :Type: String
46 :Required: Yes
47
48
49 Response Headers
50 ~~~~~~~~~~~~~~~~
51
52 The response from the server should include an ``X-Auth-Token`` value. The 
53 response may also contain a ``X-Storage-Url`` that provides the 
54 ``{api version}/{account}`` prefix that is specified in other requests
55 throughout the API documentation.
56
57
58 ``X-Storage-Token`` 
59
60 :Description: The authorization token for the ``X-Auth-User`` specified in the request.
61 :Type: String
62
63
64 ``X-Storage-Url`` 
65
66 :Description: The URL and ``{api version}/{account}`` path for the user.
67 :Type: String
68
69 A typical response looks like this:: 
70
71         HTTP/1.1 204 No Content
72         Date: Mon, 16 Jul 2012 11:05:33 GMT
73         Server: swift
74         X-Storage-Url: https://swift.radosgwhost.com/v1/ACCT-12345
75         X-Auth-Token: UOlCCC8TahFKlWuv9DB09TWHF0nDjpPElha0kAa
76         Content-Length: 0
77     Content-Type: text/plain; charset=UTF-8