Skip to content

Commit 837f155

Browse files
authored
Update authentication.rst
1 parent 55cb2e1 commit 837f155

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

docs/source/user_guide/cli/authentication.rst

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ In the this example, the default authentication uses API keys specified with the
121121
os_auth = authutil.resource_principal() # use resource principal to as the preferred way to access object store
122122
123123
124-
More signers can be created using the ``create_signer()`` method. With the ``auth_type`` parameter set to ``instance_principal``, the method will return a signer that uses instance principals. For other signers there are ``signer`` or ``signer_callable`` parameters. Here are examples:
124+
More signers can be created using the ``create_signer()`` method. With the ``auth_type`` parameter set to ``instance_principal``, the method will return a signer that uses instance principals. For other signers there are ``signer``, ``signer_callable`` or ``signer_kwargs`` parameters. Here are examples:
125125

126126
.. code-block:: python
127127
@@ -139,5 +139,21 @@ More signers can be created using the ``create_signer()`` method. With the ``aut
139139
signer_callable = oci.auth.signers.InstancePrincipalsSecurityTokenSigner
140140
signer_kwargs = dict(log_requests=True) # will log the request url and response data when retrieving
141141
auth = ads.auth.create_signer(signer_callable=signer_callable, signer_kwargs=signer_kwargs)
142+
143+
# Example 4. Create signer that carries oci config in signer_kwargs. You can either pass key_file or key_content to signer_kwargs.
144+
private_key_content = """
145+
-----BEGIN RSA PRIVATE KEY-----
146+
MIIBIjANBgkqhkiG9w0BAQE...
147+
...
148+
-----END RSA PRIVATE KEY-----
149+
"""
150+
signer_kwargs = dict(
151+
"user": "ocid1.user.oc1..xxx",
152+
"fingerprint": "35:67:25:90:89:87:45:78:bf:4h:g5:13:16:32:4d:f4",
153+
"tenancy": "ocid1.tenancy.oc1..xxx",
154+
"region": "us-ashburn-1",
155+
"key_content": private_key_content,
156+
)
157+
auth = ads.auth.create_signer(signer_kwargs=signer_kwargs)
142158
143159
``AuthContext`` context class can also be used to specify the desired type of authentication. It supports API key configuration, resource principal, and instance principal authentication, as well as predefined signers, callable signers, or API keys configurations from specified locations. See `API Documentation <../../ads.common.html#ads.common.auth.AuthContext>`__ for more details.

0 commit comments

Comments
 (0)