19 declare(strict_types=1);
48 $this->response_factory =
new Factory($context);
50 $this->handlers[$handler->getNamespace()] =
$handler;
59 $http = $this->context->http();
61 $request = $this->request_builder->buildRequest(
63 $this->context->refinery(),
66 if (!$request instanceof
Request) {
67 throw new \RuntimeException(
'No request could be built');
70 $handler = $this->handlers[$request->getNamespace()] ??
null;
72 throw new \InvalidArgumentException(
'No handler found for namespace ' . $request->getNamespace());
75 if (!$response->targetCanBeReached()) {
76 throw new \RuntimeException(
77 'Handler ' .
$handler->getNamespace() .
' did not return a URI' 85 $target = $uri_builder->buildTarget(
86 $request->getNamespace(),
87 $request->getReferenceId(),
88 $request->getAdditionalParameters()
90 $full_uri = $base_uri .
"/login.php?target=";
91 $full_uri .= str_replace(
'/',
'_', rtrim($target,
'/'));
92 if (!$this->context->isUserLoggedIn()) {
93 $full_uri .=
'&cmd=force_login&lang=' . $this->context->getUserLanguage();
98 $this->context->mainTemplate()->setOnScreenMessage(
100 $this->context->lng()->txt(
'permission_denied'),
103 $full_uri = $base_uri .
'/index.php';
107 $uri_path = $response->getURIPath() ??
'';
108 $base_path = $base_uri->
getPath() ??
'';
109 if ($base_path !==
'' && $base_path !==
'/') {
110 $uri_path = str_replace(rtrim($base_path,
'/') .
'/',
'', $uri_path);
112 $full_uri = $base_uri .
'/' . trim((
string) $uri_path,
'/');
117 $http->response()->withAddedHeader(
'Location', $full_uri)
119 $http->sendResponse();
129 if ($context->
http()->wrapper()->query()->has(
'soap_pw')) {
130 return \ilUtil::appendUrlParameterString(
132 'soap_pw=' . $context->
http()->wrapper()->query()->retrieve(
134 $context->
refinery()->kindlyTo()->string()
138 if ($context->
http()->wrapper()->query()->has(
'ext_uid')) {
139 return \ilUtil::appendUrlParameterString(
141 'ext_uid=' . $context->
http()->wrapper()->query()->retrieve(
143 $context->
refinery()->kindlyTo()->string()
performRedirect(URI $base_uri)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
appendUnknownParameters(Context $context, string $full_uri)
__construct(private RequestBuilder $request_builder, private Context $context, Handler ... $handlers,)
Factory $response_factory