Browse Source

Fixed booting sequence for ClientAuthContextValidatorFactoryProvider

bc was failing to get the current route for token endpoint

Change-Id: Ia5a0b253e9b33c1d5888c8d7e7ec434a1b1ffb76
smarcet 3 months ago
parent
commit
f5d5d08494
1 changed files with 12 additions and 8 deletions
  1. 12
    8
      app/Providers/OAuth2/ClientAuthContextValidatorFactoryProvider.php

+ 12
- 8
app/Providers/OAuth2/ClientAuthContextValidatorFactoryProvider.php View File

@@ -26,15 +26,19 @@ final class ClientAuthContextValidatorFactoryProvider extends ServiceProvider
26 26
 
27 27
     public function boot()
28 28
     {
29
-        ClientAuthContextValidatorFactory::setTokenEndpointUrl
30
-        (
31
-            URL::action('OAuth2\OAuth2ProviderController@token')
32
-        );
29
+        // wait till app is fully booted so we have access to routes
30
+        $this->app->booted(function () {
31
+            ClientAuthContextValidatorFactory::setTokenEndpointUrl
32
+            (
33
+                URL::action('OAuth2\OAuth2ProviderController@token')
34
+            );
35
+
36
+            ClientAuthContextValidatorFactory::setJWKSetReader
37
+            (
38
+                App::make(\OAuth2\Services\IClientJWKSetReader::class)
39
+            );
40
+        });
33 41
 
34
-        ClientAuthContextValidatorFactory::setJWKSetReader
35
-        (
36
-            App::make(\OAuth2\Services\IClientJWKSetReader::class)
37
-        );
38 42
     }
39 43
     /**
40 44
      * Register the service provider.

Loading…
Cancel
Save