@@ -261,14 +261,34 @@ async def test_explicit_azure_metadata_server_error_raises_auth_error(exception)
261
261
262
262
263
263
async def test_explicit_azure_wrong_issuer_raises_error (fake_azure_metadata_service ):
264
- fake_azure_metadata_service .iss = "not-azure "
264
+ fake_azure_metadata_service .iss = "https://notazure.com "
265
265
266
266
auth_class = AuthByWorkloadIdentity (provider = AttestationProvider .AZURE )
267
267
with pytest .raises (ProgrammingError ) as excinfo :
268
268
await auth_class .prepare ()
269
269
assert "No workload identity credential was found for 'AZURE'" in str (excinfo .value )
270
270
271
271
272
+ @pytest .mark .parametrize (
273
+ "issuer" ,
274
+ [
275
+ "https://sts.windows.net/067802cd-8f92-4c7c-bceb-ea8f15d31cc5" ,
276
+ "https://login.microsoftonline.com/067802cd-8f92-4c7c-bceb-ea8f15d31cc5" ,
277
+ "https://login.microsoftonline.com/067802cd-8f92-4c7c-bceb-ea8f15d31cc5/v2.0" ,
278
+ ],
279
+ ids = ["v1" , "v2_without_suffix" , "v2_with_suffix" ],
280
+ )
281
+ async def test_explicit_azure_v1_and_v2_issuers_accepted (
282
+ fake_azure_metadata_service , issuer
283
+ ):
284
+ fake_azure_metadata_service .iss = issuer
285
+
286
+ auth_class = AuthByWorkloadIdentity (provider = AttestationProvider .AZURE )
287
+ await auth_class .prepare ()
288
+
289
+ assert issuer == json .loads (auth_class .assertion_content )["iss" ]
290
+
291
+
272
292
async def test_explicit_azure_plumbs_token_to_api (fake_azure_metadata_service ):
273
293
auth_class = AuthByWorkloadIdentity (provider = AttestationProvider .AZURE )
274
294
await auth_class .prepare ()
0 commit comments