This is an implementation of a TVM delivering temporary and restricted tokens to access various cloud services. Users authenticate to the TVM with their Adobe I/O Runtime (a.k.a OpenWhisk) credentials and are only authorized to access their own resources.
A set of Adobe I/O TVM actions are deployed behind the Adobe I/O Gateway at https://firefly-tvm.adobe.io
.
cURL
namespace
and auth
azure/blob/{namespace}
, azure/cosmos/{namespace}
, aws/s3/{namespace}
, azure/presign/{namespace}
curl "https://firefly-tvm.adobe.io/azure/blob/{namespace}" \
-H "Authorization: Basic {base 64 of auth}" \
-H "x-Api-Key: firefly-aio-tvm"
goto
API
You want to share a cloud service that you own (e.g 1 S3 account) with a set of OpenWhisk namespaces and you want to make sure that each namespace has access only to the resources they own (e.g can only see their S3 blobs).
This might be useful for you if:
npm install -g @adobe/aio-cli
npm install
.env
:
# Adobe I/O Runtime deployment credentials
AIO_RUNTIME_APIVERSION=v1
AIO_RUNTIME_APIHOST=https://adobeioruntime.net
AIO_RUNTIME_NAMESPACE=<deployment_ns>
AIO_RUNTIME_AUTH=<deployment_auth_ns>
# TVM credentials options
EXPIRATION_DURATION=<token expiration in seconds>
EXPIRATION_DURATION_STATE_LIB=<State lib expiration token>
APPROVED_LIST=<comma separated list of namespaces>
# AWS S3 credentials
AWS_ACCESS_KEY_ID=<key id of IAM user created in AWS>
AWS_SECRET_ACCESS_KEY=<secret of IAM user created in AWS>
AWS_REGION=us-east-1
S3_BUCKET=<MY_BUCKET>
# Azure Storage account credentials
AZURE_STORAGE_ACCOUNT=<storage account name>
AZURE_STORAGE_ACCESS_KEY=<storage access key>
# Azure Cosmos Credentials
AZURE_COSMOS_ACCOUNT=<cosmosdb account name>
AZURE_COSMOS_MASTER_KEY=<cosmosdb master key>
AZURE_COSMOS_DATABASE_ID=<cosmosdb database name>
AZURE_COSMOS_CONTAINER_ID=<cosmosdb database name>
# Adobe I/O API Gateway token validation specific
DISABLE_ADOBE_IO_API_GW_TOKEN_VALIDATION=<optional, set to true if TVM is not deployed behind the Adobe I/O API Gateway>
IMS_ENV=<not relevant if DISABLE_ADOBE_IO_API_GW_TOKEN_VALIDATION=true, IMS env for validating the Adobe I/O API Gateway token>
# Optional Params for Monitoring and access control
AIO_METRICS_URL=<URL where TVM usage metrics will be sent>
AIO_DENY_LIST_URL=<URL from where to fetch service based deny list>
Use the APPROVED_LIST
variable to control which namespace can access the TVM and
hence who can deploy files to your S3 Bucket.
APPROVED_LIST=*
to allow access to
every OpenWhisk namespace in the same domain.AZURE_STORAGE_*
variables in .env
+ Add Container
:
/partitionKey
=> the name is importantAZURE_COSMOS_MASTER_KEY
Create a Bucket in S3 that will host the app folders
Create an IAM user with the following IAM policy in AWS, replace MY_BUCKET
with your bucket name:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowTokenDelivery",
"Effect": "Allow",
"Action": "sts:GetFederationToken",
"Resource": "*"
},
{
"Sid": "AllowS3",
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:DeleteObject",
"s3:PutObjectAcl",
"s3:ListBucket",
],
"Resource": [
"arn:aws:s3:::MY_BUCKET/*",
"arn:aws:s3:::MY_BUCKET"
]
}
]
}
Configure the .env
file, see config
you likely need to undeploy first to refresh the I/O Runtime Api GW
aio rt api delete tvm && aio app deploy
will deploy all TVM endpoints to the OpenWhisk namespace configured in .env
.
aio app undeploy
to undeploynpm run release
will run tests, bump up the version and release tags to github.Contributions are welcomed! Read the Contributing Guide for more information.
This project is licensed under the Apache V2 License. See LICENSE for more information.