Adds temporary workaround for issue in pathfinder_esi dep
This commit is contained in:
parent
8caa317b27
commit
64c167ec0a
3 changed files with 107 additions and 1 deletions
|
|
@ -34,6 +34,7 @@ COPY --chown=nobody --from=build /app pathfinder
|
||||||
RUN chmod 0766 pathfinder/logs pathfinder/tmp/ && rm index.php && touch /etc/nginx/.setup_pass && chmod +x /entrypoint.sh
|
RUN chmod 0766 pathfinder/logs pathfinder/tmp/ && rm index.php && touch /etc/nginx/.setup_pass && chmod +x /entrypoint.sh
|
||||||
COPY static/pathfinder/routes.ini /var/www/html/pathfinder/app/
|
COPY static/pathfinder/routes.ini /var/www/html/pathfinder/app/
|
||||||
COPY static/pathfinder/environment.ini /var/www/html/pathfinder/app/templateEnvironment.ini
|
COPY static/pathfinder/environment.ini /var/www/html/pathfinder/app/templateEnvironment.ini
|
||||||
|
COPY static/pathfinder/Sso.php /var/www/html/pathfinder/vendor/exodus4d/pathfinder_esi/app/Client/Ccp/Sso/Sso.php
|
||||||
|
|
||||||
WORKDIR /var/www/html
|
WORKDIR /var/www/html
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 8a3f3f380f3c4e5bcf0fc41ddd5f136865c51f74
|
Subproject commit 3514c2de7c79d97828675f113012031022194b4a
|
||||||
105
static/pathfinder/Sso.php
Normal file
105
static/pathfinder/Sso.php
Normal file
|
|
@ -0,0 +1,105 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: Exodus 4D
|
||||||
|
* Date: 26.12.2018
|
||||||
|
* Time: 16:21
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Exodus4D\ESI\Client\Ccp\Sso;
|
||||||
|
|
||||||
|
use Exodus4D\ESI\Client\Ccp;
|
||||||
|
use Exodus4D\ESI\Config\ConfigInterface;
|
||||||
|
use Exodus4D\ESI\Config\Ccp\Sso\Config;
|
||||||
|
use Exodus4D\ESI\Lib\RequestConfig;
|
||||||
|
use Exodus4D\ESI\Lib\WebClient;
|
||||||
|
use Exodus4D\ESI\Mapper;
|
||||||
|
|
||||||
|
class Sso extends Ccp\AbstractCcp implements SsoInterface {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* verify character data by "access_token"
|
||||||
|
* -> get some basic information (like character id)
|
||||||
|
* -> if more character information is required, use ESI "characters" endpoints request instead
|
||||||
|
* @param string $accessToken
|
||||||
|
* @return RequestConfig
|
||||||
|
*/
|
||||||
|
protected function getVerifyCharacterRequest(string $accessToken) : RequestConfig {
|
||||||
|
$requestOptions = [
|
||||||
|
'headers' => $this->getAuthHeader($accessToken, 'Bearer')
|
||||||
|
];
|
||||||
|
|
||||||
|
return new RequestConfig(
|
||||||
|
WebClient::newRequest('GET', $this->getVerifyUserEndpointURI()),
|
||||||
|
$requestOptions,
|
||||||
|
function($body) : array {
|
||||||
|
$characterData = [];
|
||||||
|
if(!$body->error){
|
||||||
|
$characterData = (new Mapper\Sso\Character($body))->getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $characterData;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get a valid "access_token" for oAuth 2.0 verification
|
||||||
|
* -> verify $authCode and get NEW "access_token"
|
||||||
|
* $requestParams['grant_type] = 'authorization_code'
|
||||||
|
* $requestParams['code] = 'XXXX'
|
||||||
|
* -> request NEW "access_token" if isset:
|
||||||
|
* $requestParams['grant_type] = 'refresh_token'
|
||||||
|
* $requestParams['refresh_token] = 'XXXX'
|
||||||
|
* @param array $credentials
|
||||||
|
* @param array $requestParams
|
||||||
|
* @return RequestConfig
|
||||||
|
*/
|
||||||
|
protected function getAccessRequest(array $credentials, array $requestParams = []) : RequestConfig {
|
||||||
|
$requestOptions = [
|
||||||
|
'form_params' => $requestParams,
|
||||||
|
'auth' => $credentials
|
||||||
|
];
|
||||||
|
|
||||||
|
return new RequestConfig(
|
||||||
|
WebClient::newRequest('POST', $this->getVerifyAuthorizationCodeEndpointURI()),
|
||||||
|
$requestOptions,
|
||||||
|
function($body) : array {
|
||||||
|
$accessData = [];
|
||||||
|
if(!$body->error){
|
||||||
|
$accessData = (new Mapper\Sso\Access($body))->getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $accessData;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getAuthorizationEndpointURI() : string {
|
||||||
|
return '/oauth/authorize';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getVerifyUserEndpointURI() : string {
|
||||||
|
return '/oauth/verify';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getVerifyAuthorizationCodeEndpointURI() : string {
|
||||||
|
return '/oauth/token';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return ConfigInterface
|
||||||
|
*/
|
||||||
|
protected function getConfig() : ConfigInterface {
|
||||||
|
return ($this->config instanceof ConfigInterface) ? $this->config : $this->config = new Config();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue