mirror of
https://github.com/hoshikawa2/OCI_API_Gateway_Automation2.git
synced 2026-03-06 10:11:01 +00:00
Funcionalidade Adicional: Autenticação por Resource Principal e Vault.
This commit is contained in:
15
README.md
15
README.md
@@ -193,8 +193,23 @@ You can create a **Vault** and the secrets for use in your function code:
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
This is the code to obtain the secret value after the **base64** translation.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
Now, you can specify the **Secret OCID** to obtain the secret. The code are protected by **Resource Principal**.
|
Now, you can specify the **Secret OCID** to obtain the secret. The code are protected by **Resource Principal**.
|
||||||
|
|
||||||
|
Declare the method to obtain and decode **base64**:
|
||||||
|
|
||||||
|
def read_secret_value(secret_client, secret_id):
|
||||||
|
response = secret_client.get_secret_bundle(secret_id)
|
||||||
|
base64_Secret_content = response.data.secret_bundle_content.content
|
||||||
|
base64_secret_bytes = base64_Secret_content.encode('ascii')
|
||||||
|
base64_message_bytes = base64.b64decode(base64_secret_bytes)
|
||||||
|
secret_content = base64_message_bytes.decode('ascii')
|
||||||
|
return secret_content
|
||||||
|
|
||||||
|
|
||||||
Declare the initialization for your secret client:
|
Declare the initialization for your secret client:
|
||||||
|
|
||||||
secret_client = oci.secrets.SecretsClient(config={}, signer=signer)
|
secret_client = oci.secrets.SecretsClient(config={}, signer=signer)
|
||||||
|
|||||||
BIN
images/base64translatecode.png
Normal file
BIN
images/base64translatecode.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 54 KiB |
Reference in New Issue
Block a user