Skip to content

Commit bd461ba

Browse files
committed
post merge cleanup
1 parent de29df6 commit bd461ba

File tree

3 files changed

+15
-35
lines changed

3 files changed

+15
-35
lines changed

clients/admin-ui/src/features/config-wizard/AuthenticateOktaForm.tsx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -165,17 +165,6 @@ const AuthenticateOktaForm = () => {
165165
need to create an API Services application in Okta and
166166
generate an RSA key pair.
167167
</Text>
168-
<Text fontSize="sm" color="gray.600">
169-
Need help setting up?{" "}
170-
<a
171-
href="https://ethyca.com/docs/guides/okta_privatekey_setup"
172-
target="_blank"
173-
rel="noopener noreferrer"
174-
style={{ textDecoration: "underline" }}
175-
>
176-
View setup guide
177-
</a>
178-
</Text>
179168
</Box>
180169
<Stack>
181170
<CustomTextInput

src/fides/api/service/connectors/okta_http_client.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ def __init__(
112112

113113
@staticmethod
114114
def _parse_jwk(private_key: Union[str, PrivateJwk]) -> PrivateJwk:
115-
"""Parse and validate a private key in JWK format.
115+
"""Parse private key from string or dict.
116+
117+
Note: Full validation (kty, 'd' param) is done by OktaSchema.
118+
This method handles string→dict conversion for already-validated secrets.
116119
117120
Args:
118121
private_key: JWK as either a JSON string or dict
@@ -121,23 +124,15 @@ def _parse_jwk(private_key: Union[str, PrivateJwk]) -> PrivateJwk:
121124
Parsed JWK dictionary
122125
123126
Raises:
124-
ValueError: If key is not valid JSON or missing 'd' parameter
127+
ValueError: If key is not valid JSON
125128
"""
126-
jwk_dict: PrivateJwk
127129
if isinstance(private_key, dict):
128-
jwk_dict = private_key
129-
else:
130-
try:
131-
jwk_dict = json.loads(private_key.strip())
132-
except json.JSONDecodeError as exc:
133-
raise ValueError(
134-
"Private key must be valid JSON or a dictionary."
135-
) from exc
130+
return private_key
136131

137-
if "d" not in jwk_dict:
138-
raise ValueError("JWK is not a private key (missing 'd' parameter).")
139-
140-
return jwk_dict
132+
try:
133+
return json.loads(private_key.strip())
134+
except json.JSONDecodeError as exc:
135+
raise ValueError("Private key must be valid JSON.") from exc
141136

142137
@staticmethod
143138
def _determine_alg_from_jwk(jwk: PrivateJwk) -> str:

tests/ops/service/connectors/test_okta_http_client.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -337,17 +337,13 @@ def test_parse_jwk_accepts_dict(self):
337337
parsed = OktaHttpClient._parse_jwk(RSA_JWK)
338338
assert parsed["kid"] == RSA_JWK["kid"]
339339

340-
def test_parse_jwk_validates_dict_missing_d(self):
340+
def test_parse_jwk_accepts_dict_without_d(self):
341+
# _parse_jwk no longer validates 'd' - that's done by OktaSchema
342+
# This tests that dict passthrough works regardless of content
341343
public_jwk = RSA_JWK.copy()
342344
del public_jwk["d"]
343-
with pytest.raises(ValueError, match="not a private key"):
344-
OktaHttpClient._parse_jwk(public_jwk)
345-
346-
def test_parse_jwk_validates_private_key(self):
347-
public_jwk = RSA_JWK.copy()
348-
del public_jwk["d"]
349-
with pytest.raises(ValueError):
350-
OktaHttpClient._parse_jwk(json.dumps(public_jwk))
345+
parsed = OktaHttpClient._parse_jwk(public_jwk)
346+
assert parsed["kid"] == RSA_JWK["kid"]
351347

352348
def test_parse_jwk_round_trip(self):
353349
parsed = OktaHttpClient._parse_jwk(json.dumps(RSA_JWK))

0 commit comments

Comments
 (0)