proxygen-cli 2.1.9__tar.gz → 2.1.11__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.
Files changed (36) hide show
  1. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/PKG-INFO +1 -2
  2. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/README.md +1 -1
  3. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/lib/auth.py +18 -16
  4. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/lib/constants.py +3 -0
  5. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/lib/credentials.py +5 -5
  6. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/test/command_credentials_test.py +3 -3
  7. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/pyproject.toml +1 -1
  8. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/__init__.py +0 -0
  9. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/cli/command_credentials.py +0 -0
  10. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/cli/command_docker.py +0 -0
  11. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/cli/command_instance.py +0 -0
  12. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/cli/command_main.py +0 -0
  13. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/cli/command_pytest_nhsd_apim_token.py +0 -0
  14. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/cli/command_secret.py +0 -0
  15. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/cli/command_settings.py +0 -0
  16. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/cli/command_spec.py +0 -0
  17. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/lib/dot_proxygen.py +0 -0
  18. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/lib/output.py +0 -0
  19. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/lib/proxygen_api.py +0 -0
  20. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/lib/settings.py +0 -0
  21. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/lib/spec.py +0 -0
  22. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/lib/spec_server.py +0 -0
  23. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/lib/version.py +0 -0
  24. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/test/__init__.py +0 -0
  25. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/test/command_instance_test.py +0 -0
  26. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/test/command_main_test.py +0 -0
  27. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/test/command_pytest_nhsd_apim_token_test.py +0 -0
  28. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/test/command_secret_test.py +0 -0
  29. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/test/command_settings_test.py +0 -0
  30. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/test/command_spec_test.py +0 -0
  31. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/test/conftest.py +0 -0
  32. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/test/fixtures/client.key +0 -0
  33. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/test/fixtures/client.pem +0 -0
  34. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/test/fixtures/secret.txt +0 -0
  35. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/test/mock_private_key.py +0 -0
  36. {proxygen_cli-2.1.9 → proxygen_cli-2.1.11}/proxygen_cli/test/validate_cli_version_test.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: proxygen-cli
3
- Version: 2.1.9
3
+ Version: 2.1.11
4
4
  Summary: CLI for interacting with NHSD APIM's proxygen service
5
5
  Home-page: https://github.com/NHSDigital/proxygen-cli
6
6
  Author: Ben Strutt
@@ -109,4 +109,3 @@ Use the following command to obtain the pytest-nhsd-apim token:
109
109
  ```
110
110
  $(proxygen pytest_nhsd_apim get_token)
111
111
  ```
112
-
@@ -83,4 +83,4 @@ When testing using the pytest-nhsd-apim python testing package, an apigee manage
83
83
  Use the following command to obtain the pytest-nhsd-apim token:
84
84
  ```
85
85
  $(proxygen pytest_nhsd_apim get_token)
86
- ```
86
+ ```
@@ -1,5 +1,4 @@
1
1
  """Proxygen test utility functions"""
2
- import functools
3
2
  import hashlib
4
3
  import json
5
4
  import uuid
@@ -72,9 +71,7 @@ def access_token():
72
71
  return token_data["access_token"]
73
72
 
74
73
 
75
- def _get_token_data_from_refresh_token(
76
- refresh_token: str
77
- ):
74
+ def _get_token_data_from_refresh_token(refresh_token: str):
78
75
  CREDENTIALS = get_credentials()
79
76
  token_response = requests.post(
80
77
  f"{CREDENTIALS.base_url}/protocol/openid-connect/token",
@@ -92,7 +89,7 @@ def _get_token_data_from_refresh_token(
92
89
  def _get_token_data_from_user_login():
93
90
  session = requests.Session()
94
91
  CREDENTIALS = get_credentials()
95
- redirect_uri = f"{CREDENTIALS.base_url}/protocol/openid-connect/callback"
92
+ redirect_uri = f"{CREDENTIALS.base_url}/callback"
96
93
  login_page_resp = session.get(
97
94
  f"{CREDENTIALS.base_url}/protocol/openid-connect/auth",
98
95
  params={
@@ -105,7 +102,9 @@ def _get_token_data_from_user_login():
105
102
  )
106
103
 
107
104
  if login_page_resp.status_code != 200:
108
- raise RuntimeError(f"Login page get request status was {login_page_resp.status_code} expected to be 200")
105
+ raise RuntimeError(
106
+ f"Login page get request status was {login_page_resp.status_code} expected to be 200"
107
+ )
109
108
 
110
109
  login_form = html.fromstring(login_page_resp.content.decode()).get_element_by_id(
111
110
  "kc-form-login"
@@ -118,7 +117,11 @@ def _get_token_data_from_user_login():
118
117
  "Accept": "application/json",
119
118
  "Content-Type": "application/x-www-form-urlencoded",
120
119
  },
121
- data={"username": CREDENTIALS.username, "password": CREDENTIALS.password, "credentialId": ""},
120
+ data={
121
+ "username": CREDENTIALS.username,
122
+ "password": CREDENTIALS.password,
123
+ "credentialId": "",
124
+ },
122
125
  )
123
126
 
124
127
  http_error_msg = "Invalid username or password"
@@ -147,9 +150,6 @@ def _get_token_data_from_user_login():
147
150
  return token_response.json()
148
151
 
149
152
 
150
-
151
-
152
-
153
153
  def _get_token_data_from_machine_user():
154
154
  CREDENTIALS = get_credentials()
155
155
  aud = CREDENTIALS.base_url
@@ -164,10 +164,10 @@ def _get_token_data_from_machine_user():
164
164
  "exp": int(time()) + 300, # 5mins in the future
165
165
  }
166
166
 
167
- additional_jwt_headers = {
168
- 'kid': CREDENTIALS.key_id
169
- }
170
- client_assertion = jwt.encode(claims, private_key, algorithm="RS512", headers=additional_jwt_headers)
167
+ additional_jwt_headers = {"kid": CREDENTIALS.key_id}
168
+ client_assertion = jwt.encode(
169
+ claims, private_key, algorithm="RS512", headers=additional_jwt_headers
170
+ )
171
171
  token_response = requests.post(
172
172
  token_endpoint,
173
173
  data={
@@ -177,5 +177,7 @@ def _get_token_data_from_machine_user():
177
177
  },
178
178
  )
179
179
  if token_response.status_code != 200:
180
- raise RuntimeError(f"Token response was {token_response.status_code} expected 200")
181
- return token_response.json()
180
+ raise RuntimeError(
181
+ f"Token response was {token_response.status_code} expected 200"
182
+ )
183
+ return token_response.json()
@@ -16,3 +16,6 @@ LITERAL_SECRET_TYPES = Literal[
16
16
  "apikey",
17
17
  "mtls"
18
18
  ]
19
+
20
+ PROXYGEN_CLIENT_ID = ""
21
+ PROXYGEN_CLIENT_SECRET = ""
@@ -5,7 +5,6 @@ import yaml
5
5
  import sys
6
6
  import os
7
7
 
8
- import click
9
8
  from pydantic import (
10
9
  BaseSettings,
11
10
  validator,
@@ -14,11 +13,12 @@ from pydantic import (
14
13
  )
15
14
 
16
15
  from . import dot_proxygen
16
+ from . import constants
17
17
 
18
- CLIENT_ID = os.environ["proxygen_client_id"]
19
- CLIENT_SECRET = os.environ["proxygen_client_secret"]
20
-
21
- data = {"client_id": CLIENT_ID, "client_secret": CLIENT_SECRET}
18
+ data = {
19
+ "client_id": constants.PROXYGEN_CLIENT_ID,
20
+ "client_secret": constants.PROXYGEN_CLIENT_SECRET,
21
+ }
22
22
 
23
23
 
24
24
  def _yaml_credentials_file_source(_):
@@ -8,8 +8,8 @@ from pydantic.error_wrappers import ValidationError
8
8
 
9
9
  import proxygen_cli.cli.command_credentials as cmd_credentials
10
10
  from proxygen_cli.lib.credentials import Credentials
11
- CLIENT_ID = os.environ["proxygen_client_id"]
12
- CLIENT_SECRET = os.environ["proxygen_client_secret"]
11
+ CLIENT_ID = os.environ["PROXYGEN_CLIENT_ID"]
12
+ CLIENT_SECRET = os.environ["PROXYGEN_CLIENT_SECRET"]
13
13
 
14
14
  def get_test_credentials(**kwargs):
15
15
  base_credentials = {
@@ -321,4 +321,4 @@ def test_remove_invalid_setting(patch_config):
321
321
  runner = CliRunner()
322
322
  result = runner.invoke(cmd_credentials.rm, ["invalid"])
323
323
 
324
- assert "'invalid' is not one of 'base_url'" in result.output.strip()
324
+ assert "'invalid' is not one of 'base_url'" in result.output.strip()
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "proxygen-cli"
3
- version = "2.1.9"
3
+ version = "2.1.11"
4
4
  description = "CLI for interacting with NHSD APIM's proxygen service"
5
5
  authors = ["Ben Strutt <ben.strutt1@nhs.net>"]
6
6
  readme = "README.md"