Skip to content

Class star::AWSTokenCache

ClassList > star > AWSTokenCache

AWS SSO Token Cache reader. More...

  • #include <stards.h>

Public Static Functions

Type Name
std::optional< std::tuple< std::string, std::string, std::string > > getCredentialsFromToken (const std::string & access_token, const std::string & account_id, const std::string & role_name, const std::string & region)
Get temporary credentials using SSO token.
std::optional< SSOToken > readToken (const std::string & start_url, const std::string & sso_session="")
Find and read SSO token for a given start URL.

Detailed Description

Reads and manages SSO tokens cached by AWS CLI

Public Static Functions Documentation

function getCredentialsFromToken

Get temporary credentials using SSO token.

static inline std::optional< std::tuple< std::string, std::string, std::string > > star::AWSTokenCache::getCredentialsFromToken (
    const std::string & access_token,
    const std::string & account_id,
    const std::string & role_name,
    const std::string & region
) 

Makes API call to AWS SSO service to exchange token for credentials

Parameters:

  • access_token SSO access token
  • account_id AWS account ID
  • role_name IAM role name
  • region AWS region

Returns:

tuple of (access_key, secret_key, session_token)


function readToken

Find and read SSO token for a given start URL.

static inline std::optional< SSOToken > star::AWSTokenCache::readToken (
    const std::string & start_url,
    const std::string & sso_session=""
) 

Parameters:

  • start_url The SSO start URL from AWS config
  • sso_session The sso-session name (if the profile uses one). When non-empty it is the cache-key the AWS CLI hashes; otherwise the start_url is used. Defaults to "" for compatibility.

Returns:

SSOToken if found and valid, empty optional otherwise



The documentation for this class was generated from the following file StarDS/include/stards.h