Skip to content

Instantly share code, notes, and snippets.

@mfal
Last active July 24, 2018 12:44
Show Gist options
  • Save mfal/4ab3c33f9e5f744e268fe13344efa120 to your computer and use it in GitHub Desktop.
Save mfal/4ab3c33f9e5f744e268fe13344efa120 to your computer and use it in GitHub Desktop.
<?php
namespace Mittwald\SpacesAuth\OAuth2;
use Mw\Spaces\OAuth2\EnvironmentOptions;
class ShopwareOptions extends EnvironmentOptions
{
public function getClientID()
{
return "spaces.de/oauth/cms/shopware/" . $this->getSpaceID();
}
}
<?php
namespace Mittwald\SpacesAuth\OAuth2;
use Mw\Spaces\OAuth2\Options;
class TYPO3Options implements Options
{
private $signupURL;
private $allowSupportLogin;
private $fallback;
public function __construct(array $extensionConfiguration, Options $fallback)
{
$this->fallback = $fallback;
$this->allowSupportLogin = $fallback->isSupportLoginAllowed();
$this->signupURL = $fallback->getSignupBaseURI();
if (isset($extensionConfiguration["allowSupport"]) && $extensionConfiguration["allowSupport"] !== "") {
$this->allowSupportLogin = (bool)$extensionConfiguration["allowSupport"];
}
if (isset($extensionConfiguration["oauth2Server"]["value"]) && $extensionConfiguration["oauth2Server"]["value"] !== "") {
$this->signupURL = $extensionConfiguration["oauth2Server"]["value"];
}
}
public function getSignupBaseURI()
{
return $this->signupURL;
}
public function getSpaceID()
{
return $this->fallback->getSpaceID();
}
public function getClientID()
{
return "spaces.de/oauth/cms/typo3/" . $this->getSpaceID();
}
public function isSupportLoginAllowed()
{
return $this->allowSupportLogin;
}
}
@mfal
Copy link
Author

mfal commented Jul 24, 2018

Siehe https://github.com/mittwald/spaces-auth#usage.

Diese Options-Implementierung erzeugt eine korrekte Client-ID für den OAuth-Request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment