prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  [v2] `aws sso login` should not require a fully-configured profile
  Currently, `aws sso login` operates on a particular profile, even [requiring that `sso_account_id` and `sso_role_name` be present in the profile](https://github.com/aws/aws-cli/blob/f2788558422dac42a5ebe37c7e5a3d24b19dee9f/awscli/customizations/sso/login.py#L32) even though it does not use them, [only fetching the token](https://github.com/aws/aws-cli/blob/f2788558422dac42a5ebe37c7e5a3d24b19dee9f/awscli/customizations/sso/utils.py#L45) (as it should, because AWS SSO-capable SDKs can use the token to get credentials for the appropriate account and role).
  
  At the very least, `sso_account_id` and `sso_role_name` should be removed from the list of required config variables, which would allow a profile like:
  ```ini
  [profile login]
  sso_start_url = https://d-2e69cb2b10.awsapps.com/start
  sso_region = us-east-2
  ```
  and then `aws sso login --profile login` would just work without requiring a specific account and role that won't be used anyway.
  
  This matters because not all users in an organization have the same permissions, so there's not a good way to provide them all with a single working config file to start from.
  
  A better alternative would be to have AWS SSO configuration be explicit in the config file, perhaps with a new section type:
  ```ini
  [sso default]
  sso_start_url = https://d-2e69cb2b10.awsapps.com/start
  sso_region = us-east-2
  ```
  
  Or, `aws sso login` should check the configured profiles and if there's only one AWS SSO configuration (i.e., they all use the same start URL and region), it should just use that.
  
  I've implemented the latter in [`aws-sso-util login`](https://github.com/benkehoe/aws-sso-util#logging-in-and-out).
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `awscli/customizations/sso/login.py`
  Content:
  ```
  1 # Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
  2 #
  3 # Licensed under the Apache License, Version 2.0 (the "License"). You
  4 # may not use this file except in compliance with the License. A copy of
  5 # the License is located at
  6 #
  7 # http://aws.amazon.com/apache2.0/
  8 #
  9 # or in the "license" file accompanying this file. This file is
  10 # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
  11 # ANY KIND, either express or implied. See the License for the specific
  12 # language governing permissions and limitations under the License.
  13 from awscli.customizations.commands import BasicCommand
  14 from awscli.customizations.sso.utils import do_sso_login
  15 from awscli.customizations.utils import uni_print
  16 from awscli.customizations.exceptions import ConfigurationError
  17 
  18 
  19 class InvalidSSOConfigError(ConfigurationError):
  20     pass
  21 
  22 
  23 class LoginCommand(BasicCommand):
  24     NAME = 'login'
  25     DESCRIPTION = (
  26         'Retrieves and caches an AWS SSO access token to exchange for AWS '
  27         'credentials. To login, the requested profile must have first been '
  28         'setup using ``aws configure sso``. Each time the ``login`` command '
  29         'is called, a new SSO access token will be retrieved.'
  30     )
  31     ARG_TABLE = []
  32     _REQUIRED_SSO_CONFIG_VARS = [
  33         'sso_start_url',
  34         'sso_region',
  35         'sso_role_name',
  36         'sso_account_id',
  37     ]
  38 
  39     def _run_main(self, parsed_args, parsed_globals):
  40         sso_config = self._get_sso_config()
  41         do_sso_login(
  42             session=self._session,
  43             sso_region=sso_config['sso_region'],
  44             start_url=sso_config['sso_start_url'],
  45             force_refresh=True
  46         )
  47         success_msg = 'Successully logged into Start URL: %s\n'
  48         uni_print(success_msg % sso_config['sso_start_url'])
  49         return 0
  50 
  51     def _get_sso_config(self):
  52         scoped_config = self._session.get_scoped_config()
  53         sso_config = {}
  54         missing_vars = []
  55         for config_var in self._REQUIRED_SSO_CONFIG_VARS:
  56             if config_var not in scoped_config:
  57                 missing_vars.append(config_var)
  58             else:
  59                 sso_config[config_var] = scoped_config[config_var]
  60         if missing_vars:
  61             raise InvalidSSOConfigError(
  62                 'Missing the following required SSO configuration values: %s. '
  63                 'To make sure this profile is properly configured to use SSO, '
  64                 'please run: aws configure sso' % ', '.join(missing_vars)
  65             )
  66         return sso_config
  67
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/awscli/customizations/sso/login.py b/awscli/customizations/sso/login.py
  --- a/awscli/customizations/sso/login.py
  +++ b/awscli/customizations/sso/login.py
  @@ -26,14 +26,15 @@
           'Retrieves and caches an AWS SSO access token to exchange for AWS '
           'credentials. To login, the requested profile must have first been '
           'setup using ``aws configure sso``. Each time the ``login`` command '
  -        'is called, a new SSO access token will be retrieved.'
  +        'is called, a new SSO access token will be retrieved. Please note '
  +        'that only one login session can be active for a given SSO Start URL '
  +        'and creating multiple profiles does not allow for multiple users to '
  +        'be authenticated against the same SSO Start URL.'
       )
       ARG_TABLE = []
       _REQUIRED_SSO_CONFIG_VARS = [
           'sso_start_url',
           'sso_region',
  -        'sso_role_name',
  -        'sso_account_id',
       ]
   
       def _run_main(self, parsed_args, parsed_globals):
  
verification_info: {"golden_diff": "diff --git a/awscli/customizations/sso/login.py b/awscli/customizations/sso/login.py\n--- a/awscli/customizations/sso/login.py\n+++ b/awscli/customizations/sso/login.py\n@@ -26,14 +26,15 @@\n         'Retrieves and caches an AWS SSO access token to exchange for AWS '\n         'credentials. To login, the requested profile must have first been '\n         'setup using ``aws configure sso``. Each time the ``login`` command '\n-        'is called, a new SSO access token will be retrieved.'\n+        'is called, a new SSO access token will be retrieved. Please note '\n+        'that only one login session can be active for a given SSO Start URL '\n+        'and creating multiple profiles does not allow for multiple users to '\n+        'be authenticated against the same SSO Start URL.'\n     )\n     ARG_TABLE = []\n     _REQUIRED_SSO_CONFIG_VARS = [\n         'sso_start_url',\n         'sso_region',\n-        'sso_role_name',\n-        'sso_account_id',\n     ]\n \n     def _run_main(self, parsed_args, parsed_globals):\n", "issue": "[v2] `aws sso login` should not require a fully-configured profile\nCurrently, `aws sso login` operates on a particular profile, even [requiring that `sso_account_id` and `sso_role_name` be present in the profile](https://github.com/aws/aws-cli/blob/f2788558422dac42a5ebe37c7e5a3d24b19dee9f/awscli/customizations/sso/login.py#L32) even though it does not use them, [only fetching the token](https://github.com/aws/aws-cli/blob/f2788558422dac42a5ebe37c7e5a3d24b19dee9f/awscli/customizations/sso/utils.py#L45) (as it should, because AWS SSO-capable SDKs can use the token to get credentials for the appropriate account and role).\r\n\r\nAt the very least, `sso_account_id` and `sso_role_name` should be removed from the list of required config variables, which would allow a profile like:\r\n```ini\r\n[profile login]\r\nsso_start_url = https://d-2e69cb2b10.awsapps.com/start\r\nsso_region = us-east-2\r\n```\r\nand then `aws sso login --profile login` would just work without requiring a specific account and role that won't be used anyway.\r\n\r\nThis matters because not all users in an organization have the same permissions, so there's not a good way to provide them all with a single working config file to start from.\r\n\r\nA better alternative would be to have AWS SSO configuration be explicit in the config file, perhaps with a new section type:\r\n```ini\r\n[sso default]\r\nsso_start_url = https://d-2e69cb2b10.awsapps.com/start\r\nsso_region = us-east-2\r\n```\r\n\r\nOr, `aws sso login` should check the configured profiles and if there's only one AWS SSO configuration (i.e., they all use the same start URL and region), it should just use that.\r\n\r\nI've implemented the latter in [`aws-sso-util login`](https://github.com/benkehoe/aws-sso-util#logging-in-and-out).\n", "before_files": [{"content": "# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"). You\n# may not use this file except in compliance with the License. A copy of\n# the License is located at\n#\n# http://aws.amazon.com/apache2.0/\n#\n# or in the \"license\" file accompanying this file. This file is\n# distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n# ANY KIND, either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\nfrom awscli.customizations.commands import BasicCommand\nfrom awscli.customizations.sso.utils import do_sso_login\nfrom awscli.customizations.utils import uni_print\nfrom awscli.customizations.exceptions import ConfigurationError\n\n\nclass InvalidSSOConfigError(ConfigurationError):\n    pass\n\n\nclass LoginCommand(BasicCommand):\n    NAME = 'login'\n    DESCRIPTION = (\n        'Retrieves and caches an AWS SSO access token to exchange for AWS '\n        'credentials. To login, the requested profile must have first been '\n        'setup using ``aws configure sso``. Each time the ``login`` command '\n        'is called, a new SSO access token will be retrieved.'\n    )\n    ARG_TABLE = []\n    _REQUIRED_SSO_CONFIG_VARS = [\n        'sso_start_url',\n        'sso_region',\n        'sso_role_name',\n        'sso_account_id',\n    ]\n\n    def _run_main(self, parsed_args, parsed_globals):\n        sso_config = self._get_sso_config()\n        do_sso_login(\n            session=self._session,\n            sso_region=sso_config['sso_region'],\n            start_url=sso_config['sso_start_url'],\n            force_refresh=True\n        )\n        success_msg = 'Successully logged into Start URL: %s\\n'\n        uni_print(success_msg % sso_config['sso_start_url'])\n        return 0\n\n    def _get_sso_config(self):\n        scoped_config = self._session.get_scoped_config()\n        sso_config = {}\n        missing_vars = []\n        for config_var in self._REQUIRED_SSO_CONFIG_VARS:\n            if config_var not in scoped_config:\n                missing_vars.append(config_var)\n            else:\n                sso_config[config_var] = scoped_config[config_var]\n        if missing_vars:\n            raise InvalidSSOConfigError(\n                'Missing the following required SSO configuration values: %s. '\n                'To make sure this profile is properly configured to use SSO, '\n                'please run: aws configure sso' % ', '.join(missing_vars)\n            )\n        return sso_config\n", "path": "awscli/customizations/sso/login.py"}], "after_files": [{"content": "# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"). You\n# may not use this file except in compliance with the License. A copy of\n# the License is located at\n#\n# http://aws.amazon.com/apache2.0/\n#\n# or in the \"license\" file accompanying this file. This file is\n# distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n# ANY KIND, either express or implied. See the License for the specific\n# language governing permissions and limitations under the License.\nfrom awscli.customizations.commands import BasicCommand\nfrom awscli.customizations.sso.utils import do_sso_login\nfrom awscli.customizations.utils import uni_print\nfrom awscli.customizations.exceptions import ConfigurationError\n\n\nclass InvalidSSOConfigError(ConfigurationError):\n    pass\n\n\nclass LoginCommand(BasicCommand):\n    NAME = 'login'\n    DESCRIPTION = (\n        'Retrieves and caches an AWS SSO access token to exchange for AWS '\n        'credentials. To login, the requested profile must have first been '\n        'setup using ``aws configure sso``. Each time the ``login`` command '\n        'is called, a new SSO access token will be retrieved. Please note '\n        'that only one login session can be active for a given SSO Start URL '\n        'and creating multiple profiles does not allow for multiple users to '\n        'be authenticated against the same SSO Start URL.'\n    )\n    ARG_TABLE = []\n    _REQUIRED_SSO_CONFIG_VARS = [\n        'sso_start_url',\n        'sso_region',\n    ]\n\n    def _run_main(self, parsed_args, parsed_globals):\n        sso_config = self._get_sso_config()\n        do_sso_login(\n            session=self._session,\n            sso_region=sso_config['sso_region'],\n            start_url=sso_config['sso_start_url'],\n            force_refresh=True\n        )\n        success_msg = 'Successully logged into Start URL: %s\\n'\n        uni_print(success_msg % sso_config['sso_start_url'])\n        return 0\n\n    def _get_sso_config(self):\n        scoped_config = self._session.get_scoped_config()\n        sso_config = {}\n        missing_vars = []\n        for config_var in self._REQUIRED_SSO_CONFIG_VARS:\n            if config_var not in scoped_config:\n                missing_vars.append(config_var)\n            else:\n                sso_config[config_var] = scoped_config[config_var]\n        if missing_vars:\n            raise InvalidSSOConfigError(\n                'Missing the following required SSO configuration values: %s. '\n                'To make sure this profile is properly configured to use SSO, '\n                'please run: aws configure sso' % ', '.join(missing_vars)\n            )\n        return sso_config\n", "path": "awscli/customizations/sso/login.py"}]}