Skip to content
/ aptk Public

Proof control over an AWS principal to third parties

Notifications You must be signed in to change notification settings

yawn/aptk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

AWS Principal Token (aptk)

Go Report Card

An aptk is a simple implementation of the extraction (which should be portable among SDK implementations) and parsing logic for the authorization parts of an STS GetCallerIdentity call. This makes it possible to implement flows where Alice can prove to Bob that can she act as a certain principal (e.g. a role or an IAM user).

For this Alice extracts the Authorization and Date headers from a signed request and passes those to Bob. Bob builds his own request, exchanges thoses headers and calls STS with the SDK. Depending on the principal, the results should match the standard outcomes from STS yielding information about the principal type, account ID and possibly the username (depending on the principal type).

Usage in go

package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/sts"
	"github.com/yawn/aptk"
)

func main() {

	client := sts.New(session.New(&aws.Config{}))

	// Alice prepares the call and extracts the appropriate headers
	t, err := aptk.Prepare(client)

	if err != nil {
		panic(err)
	}

	// Bob receives those headers, builds a *Token and parses them
	res, err := aptk.Parse(client, t)

	if err != nil {
		panic(err)
	}

	fmt.Println(*res)

}

About

Proof control over an AWS principal to third parties

Topics

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages