Skip to content

Commit a4fa38b

Browse files
committed
doc/radosgw: Improve formatting in STS.rst
Some text uses hardcoded ordered list numbers and as a result have duplicate list numbers. Move to use RST ordered lists and indent the contents of each list item correctly. Fix referenced list item number in text that pointed to a wrong list item. Format references to parameter names, user IDs, file names etc as inline code. Add prompts to example commands. Change instances of "rgw" or "Radosgw" in text to "RGW". Signed-off-by: Ville Ojamo <[email protected]>
1 parent 6c01b91 commit a4fa38b

File tree

1 file changed

+65
-56
lines changed

1 file changed

+65
-56
lines changed

doc/radosgw/STS.rst

Lines changed: 65 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
===========
2-
STS in Ceph
3-
===========
1+
=============
2+
STS in Ceph
3+
=============
44

55
Secure Token Service is a web service in AWS that returns a set of temporary security credentials for authenticating federated users.
66
The link to official AWS documentation can be found here: https://docs.aws.amazon.com/STS/latest/APIReference/Welcome.html.
@@ -14,12 +14,12 @@ STS REST APIs
1414

1515
The following STS REST APIs have been implemented in Ceph Object Gateway:
1616

17-
1. AssumeRole: Returns a set of temporary credentials that can be used for
18-
cross-account access. The temporary credentials will have permissions that are
19-
allowed by both - permission policies attached with the Role and policy attached
20-
with the AssumeRole API.
17+
#. AssumeRole: Returns a set of temporary credentials that can be used for
18+
cross-account access. The temporary credentials will have permissions that are
19+
allowed by both - permission policies attached with the Role and policy attached
20+
with the AssumeRole API.
2121

22-
Parameters:
22+
Parameters:
2323
**RoleArn** (String/ Required): ARN of the Role to Assume.
2424

2525
**RoleSessionName** (String/ Required): An Identifier for the assumed role
@@ -39,11 +39,11 @@ Parameters:
3939
**TokenCode** (String/ Optional): The value provided by the MFA device, if the
4040
trust policy of the role being assumed requires MFA.
4141

42-
2. AssumeRoleWithWebIdentity: Returns a set of temporary credentials for users that
43-
have been authenticated by a web/mobile app by an OpenID Connect /OAuth2.0 Identity Provider.
44-
Currently Keycloak has been tested and integrated with RGW.
42+
#. AssumeRoleWithWebIdentity: Returns a set of temporary credentials for users that
43+
have been authenticated by a web/mobile app by an OpenID Connect /OAuth2.0 Identity Provider.
44+
Currently Keycloak has been tested and integrated with RGW.
4545

46-
Parameters:
46+
Parameters:
4747
**RoleArn** (String/ Required): ARN of the Role to Assume.
4848

4949
**RoleSessionName** (String/ Required): An Identifier for the assumed role
@@ -70,7 +70,7 @@ An example of a policy that uses the 'aud' claim in the condition is of the form
7070

7171
'''{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"Federated":["arn:aws:iam:::oidc-provider/<URL of IDP>"]},"Action":["sts:AssumeRoleWithWebIdentity"],"Condition":{"StringEquals":{"<URL of IDP> :app_id":"<aud>"}}}]}'''
7272

73-
The app_id in the condition above must match the 'aud' claim of the incoming token.
73+
The ``app_id`` in the condition above must match the 'aud' claim of the incoming token.
7474

7575
An example of a policy that uses the 'sub' claim in the condition is of the form::
7676

@@ -81,8 +81,8 @@ Similarly, an example of a policy that uses 'azp' claim in the condition is of t
8181
"{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"Federated\":[\"arn:aws:iam:::oidc-provider/<URL of IDP>\"]},\"Action\":[\"sts:AssumeRoleWithWebIdentity\"],\"Condition\":{\"StringEquals\":{\"<URL of IDP> :azp\":\"<azp>\"\}\}\}\]\}"
8282

8383
A shadow user is created corresponding to every federated user. The user id is derived from the 'sub' field of the incoming web token.
84-
The user is created in a separate namespace - 'oidc' such that the user id doesn't clash with any other user ids in rgw. The format of the user id
85-
is - <tenant>$<user-namespace>$<sub> where user-namespace is 'oidc' for users that authenticate with oidc providers.
84+
The user is created in a separate namespace - 'oidc' such that the user id doesn't clash with any other user ids in RGW. The format of the user id
85+
is - ``<tenant>$<user-namespace>$<sub>`` where user-namespace is 'oidc' for users that authenticate with oidc providers.
8686

8787
RGW now supports Session tags that can be passed in the web token to AssumeRoleWithWebIdentity call. More information related to Session Tags can be found here
8888
:doc:`session-tags`.
@@ -104,18 +104,19 @@ Notes:
104104

105105
Examples
106106
========
107-
1. In order to get the example to work, make sure that the user TESTER has the ``roles`` capability assigned:
108107

109-
.. code-block:: console
108+
#. In order to get the example to work, make sure that the user ``TESTER`` has the ``roles`` capability assigned:
109+
110+
.. prompt:: bash #
110111

111-
radosgw-admin caps add --uid="TESTER" --caps="roles=*"
112+
radosgw-admin caps add --uid="TESTER" --caps="roles=*"
112113

113-
2. The following is an example of the AssumeRole API call, which shows steps to create a role, assign a policy to it
114+
#. The following is an example of the AssumeRole API call, which shows steps to create a role, assign a policy to it
114115
(that allows access to S3 resources), assuming a role to get temporary credentials and accessing S3 resources using
115-
those credentials. In this example, TESTER1 assumes a role created by TESTER, to access S3 resources owned by TESTER,
116+
those credentials. In this example, ``TESTER1`` assumes a role created by ``TESTER``, to access S3 resources owned by ``TESTER``,
116117
according to the permission policy attached to the role.
117118

118-
.. code-block:: python
119+
.. code-block:: python
119120
120121
import boto3
121122
@@ -166,11 +167,11 @@ Examples
166167
s3bucket = s3client.create_bucket(Bucket=bucket_name)
167168
resp = s3client.list_buckets()
168169
169-
2. The following is an example of AssumeRoleWithWebIdentity API call, where an external app that has users authenticated with
170-
an OpenID Connect/ OAuth2 IDP (Keycloak in this example), assumes a role to get back temporary credentials and access S3 resources
171-
according to permission policy of the role.
170+
#. The following is an example of AssumeRoleWithWebIdentity API call, where an external app that has users authenticated with
171+
an OpenID Connect/ OAuth2 IDP (Keycloak in this example), assumes a role to get back temporary credentials and access S3 resources
172+
according to permission policy of the role.
172173

173-
.. code-block:: python
174+
.. code-block:: python
174175
175176
import boto3
176177
@@ -233,42 +234,50 @@ according to permission policy of the role.
233234
234235
How to obtain thumbprint of an OpenID Connect Provider IDP
235236
==========================================================
236-
1. Take the OpenID connect provider's URL and add /.well-known/openid-configuration
237-
to it to get the URL to get the IDP's configuration document. For example, if the URL
238-
of the IDP is http://localhost:8000/auth/realms/quickstart, then the URL to get the
239-
document from is http://localhost:8000/auth/realms/quickstart/.well-known/openid-configuration
240-
241-
2. Use the following curl command to get the configuration document from the URL described
242-
in step 1::
243-
244-
curl -k -v \
245-
-X GET \
246-
-H "Content-Type: application/x-www-form-urlencoded" \
247-
"http://localhost:8000/auth/realms/quickstart/.well-known/openid-configuration" \
248-
| jq .
249-
250-
3. From the response of step 2, use the value of "jwks_uri" to get the certificate of the IDP,
251-
using the following code::
252-
curl -k -v \
253-
-X GET \
254-
-H "Content-Type: application/x-www-form-urlencoded" \
255-
"http://$KC_SERVER/$KC_CONTEXT/realms/$KC_REALM/protocol/openid-connect/certs" \
237+
238+
#. Take the OpenID connect provider's URL and add ``/.well-known/openid-configuration``
239+
to it to get the URL to get the IDP's configuration document. For example, if the URL
240+
of the IDP is http://localhost:8000/auth/realms/quickstart, then the URL to get the
241+
document from is http://localhost:8000/auth/realms/quickstart/.well-known/openid-configuration
242+
243+
#. Use the following curl command to get the configuration document from the URL described
244+
in step 1:
245+
246+
.. prompt:: bash $
247+
248+
curl -k -v \
249+
-X GET \
250+
-H "Content-Type: application/x-www-form-urlencoded" \
251+
"http://localhost:8000/auth/realms/quickstart/.well-known/openid-configuration" \
252+
| jq .
253+
254+
#. From the response of step 2, use the value of "jwks_uri" to get the certificate of the IDP,
255+
using the following code:
256+
257+
.. prompt:: bash $
258+
259+
curl -k -v \
260+
-X GET \
261+
-H "Content-Type: application/x-www-form-urlencoded" \
262+
"http://$KC_SERVER/$KC_CONTEXT/realms/$KC_REALM/protocol/openid-connect/certs" \
256263
| jq .
257264
258-
3. Copy the result of "x5c" in the response above, in a file certificate.crt, and add
259-
'-----BEGIN CERTIFICATE-----' at the beginning and "-----END CERTIFICATE-----"
260-
at the end.
265+
#. Copy the result of ``x5c`` in the response above, in a file ``certificate.crt``, and add
266+
``-----BEGIN CERTIFICATE-----`` at the beginning and ``-----END CERTIFICATE-----``
267+
at the end.
268+
269+
#. Use the following OpenSSL command to get the certificate thumbprint:
261270

262-
4. Use the following OpenSSL command to get the certificate thumbprint::
271+
.. prompt:: bash $
263272

264-
openssl x509 -in certificate.crt -fingerprint -noout
273+
openssl x509 -in certificate.crt -fingerprint -noout
265274

266-
5. The result of the above command in step 4, will be a SHA1 fingerprint, like the following::
275+
#. The result of the above command in step 5, will be a SHA1 fingerprint, like the following::
267276

268277
SHA1 Fingerprint=F7:D7:B3:51:5D:D0:D3:19:DD:21:9A:43:A9:EA:72:7A:D6:06:52:87
269278

270-
6. Remove the colons from the result above to get the final thumbprint which can be as input
271-
while creating the OpenID Connect Provider entity in IAM::
279+
#. Remove the colons from the result above to get the final thumbprint which can be as input
280+
while creating the OpenID Connect Provider entity in IAM::
272281

273282
F7D7B3515DD0D319DD219A43A9EA727AD6065287
274283

@@ -285,10 +294,10 @@ More information for OpenID Connect Provider entity manipulation
285294
can be found here
286295
:doc:`oidc`.
287296

288-
Keycloak integration with Radosgw
289-
=================================
297+
Keycloak integration with RGW
298+
=============================
290299

291-
Steps for integrating Radosgw with Keycloak can be found here
300+
Steps for integrating RGW with Keycloak can be found here
292301
:doc:`keycloak`.
293302

294303
STSLite

0 commit comments

Comments
 (0)