Skip to content

Commit

Permalink
Configurable SSO directories
Browse files Browse the repository at this point in the history
Allows configuring SSO directories explicitly in addition to more sane defaults (discovering them from AWS SDK credentials/config file locations)
  • Loading branch information
nazarewk committed Apr 21, 2022
1 parent 1af1ee0 commit af02258
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions lib/aws_sso_lib/sso.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,22 @@
from .exceptions import InvalidSSOConfigError, AuthDispatchError, AuthenticationNeededError
from .browser import OpenBrowserHandler, non_interactive_auth_raiser

SSO_TOKEN_DIR = os.path.expanduser(
os.path.join("~", ".aws", "sso", "cache")
AWS_CREDENTIALS_DIR = (
os.path.dirname(os.environ.get("AWS_SHARED_CREDENTIALS_FILE", "")) or
os.path.dirname(os.environ.get("AWS_CONFIG_FILE", "")) or
os.path.expanduser(os.path.join("~", ".aws"))
)

CREDENTIALS_CACHE_DIR = os.path.expanduser(
os.path.join("~", ".aws", "cli", "cache")
SSO_TOKEN_DIR = os.environ.get("AWS_SSO_UTIL_SSO_TOKEN_DIR") or os.path.join(
AWS_CREDENTIALS_DIR,
"sso",
"cache",
)

CREDENTIALS_CACHE_DIR = os.environ.get("AWS_SSO_UTIL_CREDENTIALS_CACHE_DIR") or os.path.join(
AWS_CREDENTIALS_DIR,
"cli",
"cache",
)

LOGGER = logging.getLogger(__name__)
Expand Down

0 comments on commit af02258

Please sign in to comment.