File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,7 +31,15 @@ class Application extends App implements IBootstrap {
3131 */
3232 public function __construct (array $ urlParams = []) {
3333 parent ::__construct (self ::APP_ID , $ urlParams );
34- }
34+ $ container ->registerService (SolidCorsMiddleware::class, function (IServerContainer $ c ): SolidCorsMiddleware {
35+ return new SolidCorsMiddleware (
36+ $ c ->get (IRequest::class)
37+ );
38+ });
39+
40+ // executed in the order that it is registered
41+ $ container ->registerMiddleware (SolidCorsMiddleware::class);
42+ }
3543
3644 public function register (IRegistrationContext $ context ): void {
3745 $ context ->registerWellKnownHandler (\OCA \Solid \WellKnown \OpenIdConfigurationHandler::class);
@@ -54,18 +62,6 @@ public function register(IRegistrationContext $context): void {
5462 $ context ->registerService ('User ' , function ($ c ) {
5563 return $ c ->query ('UserSession ' )->getUser ();
5664 });
57-
58- /**
59- * Middleware
60- */
61- $ context ->registerService ('SolidCorsMiddleware ' , function ($ c ) {
62- return new SolidCorsMiddleware (
63- $ c ->get (IRequest::class)
64- );
65- });
66-
67- // executed in the order that it is registered
68- $ context ->registerMiddleware ('SolidCorsMiddleware ' );
6965 }
7066
7167 public function boot (IBootContext $ context ): void {
You can’t perform that action at this time.
0 commit comments