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