@@ -64,6 +64,7 @@ import (
6464 "github.com/thunder-id/thunderid/internal/oauth/oauth2/dpop"
6565 "github.com/thunder-id/thunderid/internal/oauth/oauth2/jti"
6666 "github.com/thunder-id/thunderid/internal/oauth/oauth2/revocation"
67+ "github.com/thunder-id/thunderid/internal/oauth/oauth2/tokenservice"
6768 "github.com/thunder-id/thunderid/internal/openid4vci"
6869 "github.com/thunder-id/thunderid/internal/ou"
6970 "github.com/thunder-id/thunderid/internal/resource"
@@ -417,8 +418,14 @@ func registerServices(mux *http.ServeMux, cacheManager cache.CacheManagerInterfa
417418
418419 applicationService , applicationExporter , err := application .Initialize (
419420 mux , mcpServer , entityService , inboundClientService , ouService , i18nService ,
420- runtimeCryptoSvc , serverConfigService )
421+ runtimeCryptoSvc , serverConfigService ,
422+ func (client * providers.OAuthClient ) time.Duration {
423+ return tokenservice .ArtifactLifetime (oauthCfg , client )
424+ })
421425 fatalOnError (ctx , logger , err , "Failed to initialize ApplicationService" )
426+ // Two-phase initialization: inject the application service into the executors that act on it.
427+ fatalOnError (ctx , logger , executor .SetApplicationProvider (execRegistry , applicationService ),
428+ "Failed to inject the application provider into the flow executors" )
422429 exporters = append (exporters , applicationExporter )
423430
424431 agentService , agentExporter , err := agent .Initialize (mux , entityService , inboundClientService , ouService ,
0 commit comments