MCPcopy Create free account
hub / github.com/aws/aws-cli / do_sso_login

Function do_sso_login

awscli/customizations/sso/utils.py:77–123  ·  view source on GitHub ↗
(
    session,
    sso_region,
    start_url,
    parsed_globals,
    token_cache=None,
    on_pending_authorization=None,
    force_refresh=False,
    registration_scopes=None,
    session_name=None,
    use_device_code=False,
    resolved_start_url=None,
)

Source from the content-addressed store, hash-verified

75
76
77def do_sso_login(
78 session,
79 sso_region,
80 start_url,
81 parsed_globals,
82 token_cache=None,
83 on_pending_authorization=None,
84 force_refresh=False,
85 registration_scopes=None,
86 session_name=None,
87 use_device_code=False,
88 resolved_start_url=None,
89):
90 if token_cache is None:
91 token_cache = JSONFileCache(SSO_TOKEN_DIR, dumps_func=_sso_json_dumps)
92 if on_pending_authorization is None:
93 on_pending_authorization = OpenBrowserHandler(
94 open_browser=open_browser_with_original_ld_path
95 )
96
97 # For the auth flow, we need a non-legacy sso-session and check that the
98 # user hasn't opted into falling back to the device code flow
99 if session_name and not use_device_code:
100 token_fetcher = SSOTokenFetcherAuth(
101 sso_region=sso_region,
102 client_creator=session.create_client,
103 parsed_globals=parsed_globals,
104 auth_code_fetcher=AuthCodeFetcher(),
105 cache=token_cache,
106 on_pending_authorization=on_pending_authorization,
107 )
108 else:
109 token_fetcher = SSOTokenFetcher(
110 sso_region=sso_region,
111 client_creator=session.create_client,
112 parsed_globals=parsed_globals,
113 cache=token_cache,
114 on_pending_authorization=on_pending_authorization,
115 )
116
117 return token_fetcher.fetch_token(
118 start_url=start_url,
119 session_name=session_name,
120 force_refresh=force_refresh,
121 registration_scopes=registration_scopes,
122 resolved_start_url=resolved_start_url,
123 )
124
125
126def parse_sso_registration_scopes(raw_scopes):

Callers 3

test_do_sso_loginMethod · 0.90
_run_mainMethod · 0.90

Calls 6

fetch_tokenMethod · 0.95
SSOTokenFetcherAuthClass · 0.90
SSOTokenFetcherClass · 0.90
JSONFileCacheClass · 0.85
OpenBrowserHandlerClass · 0.85
AuthCodeFetcherClass · 0.85

Tested by 2

test_do_sso_loginMethod · 0.72