Skip to content
Snippets Groups Projects
Commit b95ec912 authored by Simon Kainz's avatar Simon Kainz
Browse files

add leaked token example

parents
Branches
No related tags found
No related merge requests found
<?php
declare(strict_types=1);
class ExternalApi implements RoomProviderInterface
{
private $rootId = "37";
public function __construct(ContainerInterface $container, LoggerInterface $logger)
{
// $this->rooms = [];
// $this->config = $container->getParameter('tu_graz.co_config');
// $this->token = $this->config['api_token'] ?? '';
$this->token = 'dshkjsfsdYshdhdfddsu64hkjadjhdAY';
$this->container = $container;
// $this->logger = $logger;
$this->cache = true;
}
private function getClient(): Client
{
//TODO: Replace
// $baseUrl = $this->config['api_url'] ?? '';
$baseUrl = 'https://online.tugraz.at/';
$stack = HandlerStack::create($this->clientHandler);
if (substr($baseUrl, -1) !== '/') {
$baseUrl .= '/';
}
$client_options = [
'base_uri' => $baseUrl,
'handler' => $stack,
];
}
public function getOrganizationUrlParameterString(string $lang = 'de'): string
{
// token is a mandatory url parameter, token via header doesn't work
$uriTemplate = new UriTemplate('ws/webservice_v1.0/rdm/rooms/xml?token={token}&orgUnitID={orgUnitID}&language={lang}');
return (string) $uriTemplate->expand([
'token' => $this->token,
'orgUnitID' => $this->rootId,
'lang' => $lang === 'en' ? 'en' : 'de',
]);
}
?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment