idp2aws 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.egg-info/
4
+ .pytest_cache/
5
+ .idea/
6
+ .python-version
7
+ dist/
8
+ build/
@@ -0,0 +1,13 @@
1
+ # Changelog
2
+
3
+ ## 0.2.0 (2026-11-10)
4
+
5
+ First release on PyPI.
6
+
7
+ - Sign in to a SAML IdP (Google Workspace, Okta, Entra ID) in Chrome, Edge or Playwright's
8
+ Chromium, and save short-lived AWS keys to a profile in `~/.aws/credentials`.
9
+ - Show the AWS role page, sorted by account name, on the first login for a profile. Later logins
10
+ use the same role. Use `--pick` to choose again.
11
+ - Commands: `setup`, `login` (`--pick`, `--json` for `credential_process`), `run`, `console`,
12
+ `profiles`, and `--version`.
13
+ - Config in `~/.idp2aws/config.toml`, with shared settings and optional per-profile overrides.
idp2aws-0.2.0/LICENSE ADDED
@@ -0,0 +1,44 @@
1
+ "Commons Clause" License Condition v1.0
2
+
3
+ The Software is provided to you by the Licensor under the License, as defined
4
+ below, subject to the following condition.
5
+
6
+ Without limiting other conditions in the License, the grant of rights under the
7
+ License will not include, and the License does not grant to you, the right to
8
+ Sell the Software.
9
+
10
+ For purposes of the foregoing, "Sell" means practicing any or all of the rights
11
+ granted to you under the License to provide to third parties, for a fee or other
12
+ consideration (including without limitation fees for hosting or consulting/
13
+ support services related to the Software), a product or service whose value
14
+ derives, entirely or substantially, from the functionality of the Software. Any
15
+ license notice or attribution required by the License must also include this
16
+ Commons Clause License Condition notice.
17
+
18
+ Software: idp2aws
19
+ License: MIT
20
+ Licensor: Saimon
21
+
22
+ -------------------------------------------------------------------------------
23
+
24
+ MIT License
25
+
26
+ Copyright (c) 2026 Saimon
27
+
28
+ Permission is hereby granted, free of charge, to any person obtaining a copy
29
+ of this software and associated documentation files (the "Software"), to deal
30
+ in the Software without restriction, including without limitation the rights
31
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
32
+ copies of the Software, and to permit persons to whom the Software is
33
+ furnished to do so, subject to the following conditions:
34
+
35
+ The above copyright notice and this permission notice shall be included in all
36
+ copies or substantial portions of the Software.
37
+
38
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
39
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
40
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
41
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
42
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
43
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
44
+ SOFTWARE.
idp2aws-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,127 @@
1
+ Metadata-Version: 2.5
2
+ Name: idp2aws
3
+ Version: 0.2.0
4
+ Summary: Get short-lived AWS keys by signing in to your SAML IdP in a real browser
5
+ Project-URL: Homepage, https://github.com/saimoncse19/idp2aws
6
+ Project-URL: Documentation, https://github.com/saimoncse19/idp2aws/blob/main/docs/USAGE.md
7
+ Project-URL: Issues, https://github.com/saimoncse19/idp2aws/issues
8
+ Project-URL: Changelog, https://github.com/saimoncse19/idp2aws/blob/main/CHANGELOG.md
9
+ Author: Saimon
10
+ License-Expression: LicenseRef-MIT-Commons-Clause
11
+ License-File: LICENSE
12
+ Keywords: aws,cli,entra-id,google-workspace,okta,saml,sso,sts
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: System Administrators
17
+ Classifier: Operating System :: MacOS
18
+ Classifier: Operating System :: Microsoft :: Windows
19
+ Classifier: Operating System :: POSIX :: Linux
20
+ Classifier: Programming Language :: Python :: 3
21
+ Classifier: Programming Language :: Python :: 3 :: Only
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Topic :: Security
24
+ Classifier: Topic :: System :: Systems Administration :: Authentication/Directory
25
+ Classifier: Topic :: Utilities
26
+ Requires-Python: >=3.12
27
+ Requires-Dist: boto3>=1.34
28
+ Requires-Dist: playwright>=1.44
29
+ Requires-Dist: typer>=0.12
30
+ Provides-Extra: dev
31
+ Requires-Dist: build>=1; extra == 'dev'
32
+ Requires-Dist: pylint>=3; extra == 'dev'
33
+ Requires-Dist: pytest-mock>=3; extra == 'dev'
34
+ Requires-Dist: pytest>=8; extra == 'dev'
35
+ Requires-Dist: twine>=5; extra == 'dev'
36
+ Description-Content-Type: text/markdown
37
+
38
+ # idp2aws
39
+
40
+ idp2aws gets short-lived AWS keys for you. You sign in to your IdP in a real browser window.
41
+ It works with Google Workspace, Okta, Entra ID and other SAML IdPs that sign you in to AWS
42
+ accounts directly.
43
+
44
+ ```sh
45
+ idp2aws setup 'https://accounts.google.com/o/saml2/initsso?idpid=XXXX&spid=YYYY'
46
+ idp2aws login dev # pick a role, idp2aws saves the keys to profile "dev"
47
+ aws --profile dev s3 ls # use the keys
48
+ idp2aws run dev -- terraform plan # run one command with the keys
49
+ idp2aws console dev # open the AWS console
50
+ ```
51
+
52
+ The first login for a profile shows the AWS role page, sorted by account name. idp2aws keeps
53
+ the role that you pick. The next logins for that profile use this role and do not show the page.
54
+ While your IdP session is active, the browser window opens and closes without input from you.
55
+
56
+ idp2aws does not work with AWS IAM Identity Center. For Identity Center, use `aws sso login`.
57
+
58
+ ## Install
59
+
60
+ idp2aws needs Python 3.12 or newer, and Google Chrome or Microsoft Edge.
61
+
62
+ Install from PyPI with pipx or pip:
63
+
64
+ ```sh
65
+ pipx install idp2aws
66
+ pip install idp2aws # if you manage the virtual environment yourself
67
+ ```
68
+
69
+ Or install from source:
70
+
71
+ ```sh
72
+ pipx install git+https://github.com/saimoncse19/idp2aws.git # latest code on main
73
+
74
+ git clone https://github.com/saimoncse19/idp2aws.git && cd idp2aws # to change the code
75
+ python3.12 -m venv .venv
76
+ .venv/bin/pip install -e .
77
+ ```
78
+
79
+ For step-by-step install on macOS, Linux and Windows, the config file and troubleshooting, see
80
+ [docs/USAGE.md](https://github.com/saimoncse19/idp2aws/blob/main/docs/USAGE.md).
81
+
82
+ ## How it works
83
+
84
+ 1. Chrome opens at the start URL. You sign in to your IdP with your usual 2-Step Verification.
85
+ 2. The IdP sends a signed SAML response to the AWS sign-in page.
86
+ 3. If you have more than one role and the profile has no role yet, idp2aws lets AWS show its
87
+ role page. You pick a role and click Sign In.
88
+ 4. idp2aws stops the SAML response before it gets to AWS, and closes the window.
89
+ 5. idp2aws calls STS `AssumeRoleWithSAML` with the SAML response and gets keys for the role.
90
+ 6. idp2aws writes the keys to the profile in `~/.aws/credentials`.
91
+
92
+ ## Development
93
+
94
+ ```sh
95
+ git clone https://github.com/saimoncse19/idp2aws.git && cd idp2aws
96
+ python3.12 -m venv .venv
97
+ source .venv/bin/activate
98
+ pip install -e '.[dev]'
99
+ pytest # unit tests
100
+ pytest -m browser # browser tests: headless Chrome with a fake IdP and AWS role page
101
+ pylint src scripts
102
+ ```
103
+
104
+ The `CI` workflow runs the same checks on each pull request, and also builds the packages.
105
+
106
+ ## Release
107
+
108
+ idp2aws uses semantic versioning: `MAJOR.MINOR.PATCH`. Each release must be the next patch,
109
+ minor or major version after the latest one on PyPI. After 1.4.2, the only choices are 1.4.3,
110
+ 1.5.0 and 2.0.0.
111
+
112
+ 1. Set `__version__` in `src/idp2aws/__init__.py`. This is the only place the version is set.
113
+ 2. Add the version and the date to `CHANGELOG.md`.
114
+ 3. Merge to `main`.
115
+ 4. On GitHub, create a release with the tag `v` plus the version, for example `v1.4.3`.
116
+
117
+ The `Publish to PyPI` workflow then runs the tests, checks the version and uploads to PyPI. If
118
+ the tag does not match `__version__`, or the version skips or repeats one, the workflow stops
119
+ and uploads nothing. To check a version before you release, run
120
+ `python scripts/check_version.py v1.4.3`.
121
+
122
+ ## License
123
+
124
+ idp2aws is source-available under the MIT license with the
125
+ [Commons Clause](https://commonsclause.com/). You can use, change and share it for free,
126
+ including at work. You cannot sell it, or sell a product or service whose value comes mainly
127
+ from it. See [LICENSE](https://github.com/saimoncse19/idp2aws/blob/main/LICENSE).
@@ -0,0 +1,90 @@
1
+ # idp2aws
2
+
3
+ idp2aws gets short-lived AWS keys for you. You sign in to your IdP in a real browser window.
4
+ It works with Google Workspace, Okta, Entra ID and other SAML IdPs that sign you in to AWS
5
+ accounts directly.
6
+
7
+ ```sh
8
+ idp2aws setup 'https://accounts.google.com/o/saml2/initsso?idpid=XXXX&spid=YYYY'
9
+ idp2aws login dev # pick a role, idp2aws saves the keys to profile "dev"
10
+ aws --profile dev s3 ls # use the keys
11
+ idp2aws run dev -- terraform plan # run one command with the keys
12
+ idp2aws console dev # open the AWS console
13
+ ```
14
+
15
+ The first login for a profile shows the AWS role page, sorted by account name. idp2aws keeps
16
+ the role that you pick. The next logins for that profile use this role and do not show the page.
17
+ While your IdP session is active, the browser window opens and closes without input from you.
18
+
19
+ idp2aws does not work with AWS IAM Identity Center. For Identity Center, use `aws sso login`.
20
+
21
+ ## Install
22
+
23
+ idp2aws needs Python 3.12 or newer, and Google Chrome or Microsoft Edge.
24
+
25
+ Install from PyPI with pipx or pip:
26
+
27
+ ```sh
28
+ pipx install idp2aws
29
+ pip install idp2aws # if you manage the virtual environment yourself
30
+ ```
31
+
32
+ Or install from source:
33
+
34
+ ```sh
35
+ pipx install git+https://github.com/saimoncse19/idp2aws.git # latest code on main
36
+
37
+ git clone https://github.com/saimoncse19/idp2aws.git && cd idp2aws # to change the code
38
+ python3.12 -m venv .venv
39
+ .venv/bin/pip install -e .
40
+ ```
41
+
42
+ For step-by-step install on macOS, Linux and Windows, the config file and troubleshooting, see
43
+ [docs/USAGE.md](https://github.com/saimoncse19/idp2aws/blob/main/docs/USAGE.md).
44
+
45
+ ## How it works
46
+
47
+ 1. Chrome opens at the start URL. You sign in to your IdP with your usual 2-Step Verification.
48
+ 2. The IdP sends a signed SAML response to the AWS sign-in page.
49
+ 3. If you have more than one role and the profile has no role yet, idp2aws lets AWS show its
50
+ role page. You pick a role and click Sign In.
51
+ 4. idp2aws stops the SAML response before it gets to AWS, and closes the window.
52
+ 5. idp2aws calls STS `AssumeRoleWithSAML` with the SAML response and gets keys for the role.
53
+ 6. idp2aws writes the keys to the profile in `~/.aws/credentials`.
54
+
55
+ ## Development
56
+
57
+ ```sh
58
+ git clone https://github.com/saimoncse19/idp2aws.git && cd idp2aws
59
+ python3.12 -m venv .venv
60
+ source .venv/bin/activate
61
+ pip install -e '.[dev]'
62
+ pytest # unit tests
63
+ pytest -m browser # browser tests: headless Chrome with a fake IdP and AWS role page
64
+ pylint src scripts
65
+ ```
66
+
67
+ The `CI` workflow runs the same checks on each pull request, and also builds the packages.
68
+
69
+ ## Release
70
+
71
+ idp2aws uses semantic versioning: `MAJOR.MINOR.PATCH`. Each release must be the next patch,
72
+ minor or major version after the latest one on PyPI. After 1.4.2, the only choices are 1.4.3,
73
+ 1.5.0 and 2.0.0.
74
+
75
+ 1. Set `__version__` in `src/idp2aws/__init__.py`. This is the only place the version is set.
76
+ 2. Add the version and the date to `CHANGELOG.md`.
77
+ 3. Merge to `main`.
78
+ 4. On GitHub, create a release with the tag `v` plus the version, for example `v1.4.3`.
79
+
80
+ The `Publish to PyPI` workflow then runs the tests, checks the version and uploads to PyPI. If
81
+ the tag does not match `__version__`, or the version skips or repeats one, the workflow stops
82
+ and uploads nothing. To check a version before you release, run
83
+ `python scripts/check_version.py v1.4.3`.
84
+
85
+ ## License
86
+
87
+ idp2aws is source-available under the MIT license with the
88
+ [Commons Clause](https://commonsclause.com/). You can use, change and share it for free,
89
+ including at work. You cannot sell it, or sell a product or service whose value comes mainly
90
+ from it. See [LICENSE](https://github.com/saimoncse19/idp2aws/blob/main/LICENSE).
@@ -0,0 +1,320 @@
1
+ # Using idp2aws
2
+
3
+ This guide tells you how to install idp2aws, configure it, use it every day and fix common
4
+ problems.
5
+
6
+ ## What you need
7
+
8
+ - Python 3.12 or newer.
9
+ - Google Chrome or Microsoft Edge. If you cannot install either, idp2aws can use the Chromium
10
+ build that Playwright downloads. idp2aws does not support Firefox or Safari.
11
+ - A desktop session. You sign in through a browser window that you can see. So idp2aws does
12
+ not work over plain SSH to a server.
13
+ - The start URL of your IdP for AWS. For Google Workspace, it looks like this:
14
+
15
+ ```
16
+ https://accounts.google.com/o/saml2/initsso?idpid=XXXXXXXX&spid=YYYYYYYYYYYY&forceauthn=false
17
+ ```
18
+
19
+ `idpid` is the Google id of your company. `spid` is the id of the AWS app in Google. Your
20
+ Google Workspace admin can give you both.
21
+
22
+ ## Install
23
+
24
+ You can install idp2aws in two ways:
25
+
26
+ - From PyPI, with [pipx](https://pipx.pypa.io) or pip. The steps for each operating system
27
+ follow. pipx puts the `idp2aws` command on your `PATH` and keeps its libraries apart from your
28
+ other Python tools. `pip install idp2aws` also works, but then you manage the virtual
29
+ environment.
30
+ - From source, to get the latest code on `main` or to change the code. See
31
+ [Install from source](#install-from-source).
32
+
33
+ ### macOS
34
+
35
+ 1. Install Python 3.12 and pipx:
36
+
37
+ ```sh
38
+ brew install python@3.12 pipx
39
+ pipx ensurepath
40
+ ```
41
+
42
+ 2. Open a new terminal, then install idp2aws:
43
+
44
+ ```sh
45
+ pipx install --python python3.12 idp2aws
46
+ ```
47
+
48
+ idp2aws finds Chrome in `/Applications` automatically.
49
+
50
+ ### Linux
51
+
52
+ These steps are for Debian 12, Ubuntu 24.04 and newer.
53
+
54
+ 1. Install Python and pipx:
55
+
56
+ ```sh
57
+ sudo apt install python3.12 python3.12-venv pipx
58
+ pipx ensurepath
59
+ ```
60
+
61
+ 2. Open a new terminal, then install idp2aws:
62
+
63
+ ```sh
64
+ pipx install --python python3.12 idp2aws
65
+ ```
66
+
67
+ 3. Install Google Chrome from google.com/chrome.
68
+
69
+ To use Playwright's Chromium instead of Chrome, do these steps:
70
+
71
+ 1. Install idp2aws with the `playwright` command, then install Chromium and the system libraries
72
+ that it needs:
73
+
74
+ ```sh
75
+ pipx install --python python3.12 --include-deps idp2aws
76
+ playwright install chromium
77
+ sudo "$(which playwright)" install-deps chromium
78
+ ```
79
+
80
+ 2. Add `--browser chromium` when you run `idp2aws setup`.
81
+
82
+ On Fedora, use `sudo dnf install python3.12 pipx` and the Chrome `.rpm`. Playwright
83
+ `install-deps` supports only Debian and Ubuntu. So on Fedora, Chrome is the easier choice.
84
+
85
+ ### Windows
86
+
87
+ 1. In PowerShell, install Python and pipx:
88
+
89
+ ```powershell
90
+ winget install Python.Python.3.12
91
+ py -3.12 -m pip install --user pipx
92
+ py -3.12 -m pipx ensurepath
93
+ ```
94
+
95
+ 2. Open a new PowerShell window, then install idp2aws:
96
+
97
+ ```powershell
98
+ pipx install idp2aws
99
+ ```
100
+
101
+ Windows includes Edge. If you do not have Chrome, add `--browser msedge` when you run
102
+ `idp2aws setup`.
103
+
104
+ idp2aws keeps its files in `%USERPROFILE%\.idp2aws` and `%USERPROFILE%\.aws\credentials`.
105
+
106
+ On Windows 11, WSL can show Linux windows on your desktop. So the Linux steps work in WSL.
107
+ WSL on Windows 10 has no display. On Windows 10, install idp2aws on Windows.
108
+
109
+ ### Update or remove
110
+
111
+ ```sh
112
+ pipx upgrade idp2aws
113
+ pipx uninstall idp2aws
114
+ ```
115
+
116
+ `pipx uninstall` does not delete `~/.idp2aws` or your keys in `~/.aws/credentials`.
117
+
118
+ ### Install from source
119
+
120
+ To install the latest code on `main` without a copy of the repository, use pipx with the Git
121
+ URL:
122
+
123
+ ```sh
124
+ pipx install --python python3.12 git+https://github.com/saimoncse19/idp2aws.git
125
+ ```
126
+
127
+ To change the code and use your changes at once, install from a clone. You need Python 3.12 or
128
+ newer, as in the steps above.
129
+
130
+ On macOS and Linux:
131
+
132
+ 1. Clone the repository and install idp2aws in a virtual environment:
133
+
134
+ ```sh
135
+ git clone https://github.com/saimoncse19/idp2aws.git && cd idp2aws
136
+ python3.12 -m venv .venv
137
+ .venv/bin/pip install -e .
138
+ ```
139
+
140
+ 2. Put `idp2aws` on your `PATH`:
141
+
142
+ ```sh
143
+ ln -s "$PWD/.venv/bin/idp2aws" ~/.local/bin/idp2aws
144
+ ```
145
+
146
+ If `~/.local/bin` is not on your `PATH`, add it in `~/.zshrc` or `~/.bashrc`.
147
+
148
+ On Windows, in PowerShell:
149
+
150
+ 1. Clone the repository and install idp2aws in a virtual environment:
151
+
152
+ ```powershell
153
+ git clone https://github.com/saimoncse19/idp2aws.git; cd idp2aws
154
+ py -3.12 -m venv .venv
155
+ .venv\Scripts\pip install -e .
156
+ ```
157
+
158
+ 2. Add the `.venv\Scripts` folder in `idp2aws` to your `PATH`.
159
+
160
+ With `-e`, idp2aws runs the code in the clone, so a change takes effect the next time you run
161
+ it. To use Playwright's Chromium, run `.venv/bin/playwright install chromium` (on Windows,
162
+ `.venv\Scripts\playwright install chromium`).
163
+
164
+ To run the tests and lint, see Development in the
165
+ [README](https://github.com/saimoncse19/idp2aws#development).
166
+
167
+ ## Configure idp2aws
168
+
169
+ Run `idp2aws setup` one time, with your start URL. Put the URL in single quotes, because it
170
+ contains `&`.
171
+
172
+ ```sh
173
+ idp2aws setup 'https://accounts.google.com/o/saml2/initsso?idpid=XXXX&spid=YYYY'
174
+ ```
175
+
176
+ This command creates `~/.idp2aws/config.toml`. The settings at the top apply to all profiles. A
177
+ `[profiles.<name>]` table changes settings for one profile:
178
+
179
+ ```toml
180
+ start_url = "https://accounts.google.com/o/saml2/initsso?idpid=XXXX&spid=YYYY"
181
+ browser = "chrome"
182
+ session_hours = 1
183
+
184
+ [profiles.dev]
185
+
186
+ [profiles.prod]
187
+ role_arn = "arn:aws:iam::123456789012:role/Developer"
188
+ session_hours = 4
189
+ ```
190
+
191
+ | Setting | Meaning |
192
+ | --- | --- |
193
+ | `start_url` | The start URL of your IdP for AWS. A profile can use a different URL, for example for a second AWS app. |
194
+ | `browser` | `chrome` for Google Chrome, `msedge` for Microsoft Edge, or `chromium` for Playwright's Chromium. |
195
+ | `session_hours` | How long the keys last, from 1 to 12. This value cannot be more than the maximum session duration of the role in IAM. |
196
+ | `role_arn` | The role that this profile always uses. idp2aws never shows the AWS role page for this profile. |
197
+
198
+ A profile does not need a table. `idp2aws login <any-name>` works with only the shared
199
+ settings. A table does two things:
200
+
201
+ - It shows the profile in `idp2aws profiles`.
202
+ - It lets you change settings for that profile.
203
+
204
+ To keep the idp2aws files in a different folder, set `IDP2AWS_HOME` to that folder.
205
+
206
+ ## Use idp2aws every day
207
+
208
+ ```sh
209
+ idp2aws login dev # save keys to profile "dev" in ~/.aws/credentials
210
+ aws --profile dev s3 ls # use the keys
211
+ idp2aws run dev -- terraform plan # run one command with the keys
212
+ idp2aws console dev # open the AWS console
213
+ idp2aws profiles # show each profile, its role and when its keys expire
214
+ ```
215
+
216
+ ### First login for a profile
217
+
218
+ 1. Run `idp2aws login dev`.
219
+ 2. Sign in to your IdP in the browser window.
220
+ 3. On the AWS "Select a role" page, pick a role. The page shows the accounts sorted by name.
221
+ 4. Click Sign In.
222
+
223
+ The window closes. idp2aws saves the keys and keeps the role for the profile. The AWS console
224
+ does not open.
225
+
226
+ ### Next logins
227
+
228
+ - The next logins for the profile use the same role. They do not show the AWS role page.
229
+ - If the saved keys work for more than 5 more minutes, `login` does nothing. Keys with less
230
+ than 5 minutes left count as expired, so a long command does not fail halfway through.
231
+ - `run` and `console` log in automatically when the keys expired. So you seldom need `login`.
232
+ - To use a different role, run `idp2aws login dev --pick`.
233
+ - `console` works only for commercial AWS accounts, not for GovCloud or China.
234
+
235
+ ### Let the AWS CLI log in automatically
236
+
237
+ Add a profile to `~/.aws/config` that runs idp2aws when the AWS CLI needs keys:
238
+
239
+ ```ini
240
+ [profile dev-auto]
241
+ credential_process = idp2aws login dev --json
242
+ ```
243
+
244
+ Then `aws --profile dev-auto s3 ls` logs in only when necessary.
245
+
246
+ Give this profile a name that is different from the profile that idp2aws writes to. Use
247
+ `dev-auto`, not `dev`. If the names are the same, the AWS CLI reads the old keys from
248
+ `~/.aws/credentials` and does not run idp2aws.
249
+
250
+ If your tools do not use the same `PATH` as your shell, write the full path to `idp2aws`.
251
+
252
+ ## Files
253
+
254
+ | File | Contents |
255
+ | --- | --- |
256
+ | `~/.idp2aws/config.toml` | Your settings. You edit this file. |
257
+ | `~/.idp2aws/profiles.json` | The last role of each profile and the time when its keys expire. idp2aws writes this file. |
258
+ | `~/.idp2aws/browser-profile/` | The browser profile with your IdP session cookies. To sign out, delete this folder. |
259
+ | `~/.aws/credentials` | The AWS keys, one profile for each idp2aws profile. |
260
+
261
+ **Warning:** The browser profile and the credentials file give access to your accounts. Protect
262
+ them as you protect passwords. On macOS and Linux, idp2aws makes the credentials file readable
263
+ only by you each time it saves keys.
264
+
265
+ Chrome encrypts the cookies in the browser profile with a key from the macOS Keychain or the
266
+ Linux keyring. On Linux without a keyring, Chrome uses a weaker fixed key.
267
+
268
+ ## Troubleshooting
269
+
270
+ **`idp2aws: command not found`**
271
+ The folder where pipx puts commands is not on your `PATH`. Run `pipx ensurepath`, then open a new
272
+ terminal.
273
+
274
+ **Google says "This browser or app may not be secure".**
275
+ Set `browser = "chrome"`, not `chromium`. If the message shows again, delete
276
+ `~/.idp2aws/browser-profile` and try again.
277
+
278
+ **The window opens but does not close.**
279
+ The login did not get to AWS. To check the start URL, open it in your usual browser. After 5
280
+ minutes, idp2aws stops and shows an error.
281
+
282
+ **"Cannot find chrome" (or msedge)**
283
+ idp2aws cannot find that browser. Do one of these:
284
+
285
+ - Install the browser.
286
+ - Set `browser` to the other browser.
287
+ - Run `playwright install chromium` and set `browser = "chromium"`.
288
+
289
+ **"Another idp2aws login is using the browser profile"**
290
+ Only one login can use the browser at a time. Finish or close the other login window, then try
291
+ again. This can happen when several tools ask a `credential_process` profile for keys at the
292
+ same time.
293
+
294
+ **macOS asks to allow access to "Chrome Safe Storage" in the Keychain.**
295
+ Chrome reads its cookie key from the Keychain. Click **Always Allow**.
296
+
297
+ **Linux: the browser stops at start because `.so` libraries are missing.**
298
+ Run `sudo "$(which playwright)" install-deps chromium`.
299
+
300
+ **"DurationSeconds exceeds the MaxSessionDuration"**
301
+ Make `session_hours` smaller for that profile. Or, ask an AWS admin to increase the maximum
302
+ session duration of the role.
303
+
304
+ **"You can no longer use <role>"**
305
+ Your IdP access no longer includes the role that you picked last time. Run
306
+ `idp2aws login <profile> --pick` and pick a different role.
307
+
308
+ **"The SAML response lists no AWS roles for you"**
309
+ Your IdP user has no AWS role for this app. Ask your IdP admin.
310
+
311
+ **"Token expired" or "not yet valid" from STS**
312
+ The clock on your computer may be wrong. Turn on automatic time sync.
313
+
314
+ **Comments in `~/.aws/credentials` are gone.**
315
+ idp2aws writes the full file again when it saves keys. It does not keep comments. Write your
316
+ notes in `~/.aws/config`.
317
+
318
+ **Windows: `run` works differently.**
319
+ On macOS and Linux, your command replaces idp2aws. On Windows, idp2aws starts your command as a
320
+ new process. So exit codes and Ctrl+C may work differently.
@@ -0,0 +1,67 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.27"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "idp2aws"
7
+ dynamic = ["version"]
8
+ description = "Get short-lived AWS keys by signing in to your SAML IdP in a real browser"
9
+ readme = "README.md"
10
+ license = "LicenseRef-MIT-Commons-Clause"
11
+ license-files = ["LICENSE"]
12
+ authors = [{ name = "Saimon" }]
13
+ requires-python = ">=3.12"
14
+ keywords = ["aws", "saml", "sso", "sts", "google-workspace", "okta", "entra-id", "cli"]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Environment :: Console",
18
+ "Intended Audience :: Developers",
19
+ "Intended Audience :: System Administrators",
20
+ "Operating System :: MacOS",
21
+ "Operating System :: Microsoft :: Windows",
22
+ "Operating System :: POSIX :: Linux",
23
+ "Programming Language :: Python :: 3",
24
+ "Programming Language :: Python :: 3 :: Only",
25
+ "Programming Language :: Python :: 3.12",
26
+ "Topic :: Security",
27
+ "Topic :: System :: Systems Administration :: Authentication/Directory",
28
+ "Topic :: Utilities",
29
+ ]
30
+ dependencies = [
31
+ "typer>=0.12",
32
+ "boto3>=1.34",
33
+ "playwright>=1.44",
34
+ ]
35
+
36
+ [project.optional-dependencies]
37
+ dev = ["pytest>=8", "pytest-mock>=3", "pylint>=3", "build>=1", "twine>=5"]
38
+
39
+ [project.urls]
40
+ Homepage = "https://github.com/saimoncse19/idp2aws"
41
+ Documentation = "https://github.com/saimoncse19/idp2aws/blob/main/docs/USAGE.md"
42
+ Issues = "https://github.com/saimoncse19/idp2aws/issues"
43
+ Changelog = "https://github.com/saimoncse19/idp2aws/blob/main/CHANGELOG.md"
44
+
45
+ [project.scripts]
46
+ idp2aws = "idp2aws.cli:app"
47
+
48
+ [tool.hatch.version]
49
+ path = "src/idp2aws/__init__.py"
50
+
51
+ [tool.hatch.build.targets.wheel]
52
+ packages = ["src/idp2aws"]
53
+
54
+ [tool.hatch.build.targets.sdist]
55
+ include = ["src", "scripts", "tests", "docs", "README.md", "CHANGELOG.md", "LICENSE"]
56
+
57
+ [tool.pytest.ini_options]
58
+ testpaths = ["tests"]
59
+ pythonpath = ["scripts"]
60
+ addopts = "-m 'not browser'"
61
+ markers = ["browser: starts a real browser (run with: pytest -m browser)"]
62
+
63
+ [tool.pylint.format]
64
+ max-line-length = 89
65
+
66
+ [tool.pylint."messages control"]
67
+ disable = ["too-few-public-methods"]