@@ -45,6 +45,8 @@ class Azure extends AbstractProvider
4545
4646 public $ authWithResource = true ;
4747
48+ public $ defaultAlgorithm = null ;
49+
4850 /**
4951 * The contents of the private key used for app authentication
5052 * @var string
@@ -67,6 +69,9 @@ public function __construct(array $options = [], array $collaborators = [])
6769 in_array ($ options ['defaultEndPointVersion ' ], self ::ENDPOINT_VERSIONS , true )) {
6870 $ this ->defaultEndPointVersion = $ options ['defaultEndPointVersion ' ];
6971 }
72+ if (isset ($ options ['defaultAlgorithm ' ])) {
73+ $ this ->defaultAlgorithm = $ options ['defaultAlgorithm ' ];
74+ }
7075 $ this ->grantFactory ->setGrant ('jwt_bearer ' , new JwtBearer ());
7176 }
7277
@@ -415,13 +420,13 @@ public function getJwtVerificationKeys()
415420 $ keys [$ keyinfo ['kid ' ]] = new Key ($ publicKey , 'RS256 ' );
416421 }
417422 } else if (isset ($ keyinfo ['n ' ]) && isset ($ keyinfo ['e ' ])) {
418- $ pkey_object = JWK ::parseKey ($ keyinfo );
423+ $ pkey_object = JWK ::parseKey ($ keyinfo, $ this -> defaultAlgorithm );
419424
420425 if ($ pkey_object === false ) {
421426 throw new \RuntimeException ('An attempt to read a public key from a ' . $ keyinfo ['n ' ] . ' certificate failed. ' );
422427 }
423428
424- $ pkey_array = openssl_pkey_get_details ($ pkey_object );
429+ $ pkey_array = openssl_pkey_get_details ($ pkey_object-> getKeyMaterial () );
425430
426431 if ($ pkey_array === false ) {
427432 throw new \RuntimeException ('An attempt to get a public key as an array from a ' . $ keyinfo ['n ' ] . ' certificate failed. ' );
0 commit comments