| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
These samples are used on the following documentation pages:
gcloud compute instances create INSTANCE_NAME --scopes=https://www.googleapis.com/auth/iam
gcloud projects add-iam-policy-binding PROJECT_ID --role=roles/iam.serviceAccountActor --member=serviceAccount:SERVICE_ACCOUNT
virtualenv/bin/pip install -r requirements.txt
virtualenv/bin/pip install -r requirements.txt
If you prefer to manage service account credentials manually, this method can also be used in the App Engine flexible environment, Compute Engine, and Kubernetes Engine. Note that this may be less secure, as anyone who obtains the service account private key can impersonate that account!
virtualenv/bin/pip install -r requirements.txt
Ensure that you are in the correct working directory: (/python-docs-samples/iap):
Install the libraries listed in /python-docs-samples/iap/requirements.txt, e.g. by running:
virtualenv/bin/pip install -r requirements.txt
Call sign_jwt in the python file. This example would create a JWT for the service account email@gmail.com to access the IAP protected application hosted at https://example.com.
sign_jwt("email@gmail.com", "https://example.com")
Use the result of the call to access your IAP protected resource programmatically:
curl --verbose --header 'Authorization: Bearer SIGNED_JWT' "https://example.com"
Install the libraries listed in /python-docs-samples/iap/requirements.txt, e.g. by running:
virtualenv/bin/pip install -r requirements.txt
Create a service account and download its private key. See https://cloud.google.com/iam/docs/creating-managing-service-account-keys for more information on how to do this.
Call sign_jwt_with_local_credentials_file, using the downloaded local credentials for the service account.
sign_jwt_with_local_credentials_file("path/to/key/file.json", "https://example.com")
Use the result of the call to access your IAP protected resource programmatically:
curl --verbose --header 'Authorization: Bearer SIGNED_JWT' "https://example.com"
| Back | FazBrowse Home | New Git URL |