-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
try one more time with a local gdata/vaas
- Loading branch information
1 parent
9952bfa
commit ad2cb65
Showing
46 changed files
with
3,562 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,5 +64,8 @@ js/ | |
.uuid | ||
eicar.com.txt | ||
tmp/ | ||
|
||
nextcloud-server/ | ||
core.1 | ||
nextcloud-server/ | ||
core-dump.zip | ||
apache/ | ||
**/vendor/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,38 @@ | ||
ARG NEXTCLOUD_VERSION=29.0.4 | ||
ARG INSTALL_XDEBUG=1 | ||
|
||
FROM nextcloud:${NEXTCLOUD_VERSION} | ||
FROM nextcloud:29.0.4 | ||
|
||
RUN apt update && apt install -y less vim telnet iputils-ping | ||
RUN apt update && apt install -y \ | ||
less vim telnet iputils-ping gdb libexpat1-dev libapr1-dev libaprutil1-dev devscripts debmake \ | ||
bison jdupes libbrotli-dev liblua5.4-dev libnghttp2-dev libssl-dev libxml2-dev libcurl4-openssl-dev libjansson-dev | ||
# RUN curl -L -o /tmp/apache2_2.4.61.orig.tar.gz https://launchpad.net/debian/+archive/primary/+sourcefiles/apache2/2.4.61-1/apache2_2.4.61.orig.tar.gz \ | ||
# && tar -xzf /tmp/apache2_2.4.61.orig.tar.gz -C /tmp \ | ||
# && mv /tmp/httpd-2.4.61 /tmp/apache2-2.4.61 \ | ||
# && curl -L -o /tmp/apache2_2.4.61-1.debian.tar.xz https://launchpad.net/debian/+archive/primary/+sourcefiles/apache2/2.4.61-1/apache2_2.4.61-1.debian.tar.xz \ | ||
# && tar -xf /tmp/apache2_2.4.61-1.debian.tar.xz -C /tmp \ | ||
# && mv /tmp/debian /tmp/apache2-2.4.61/debian \ | ||
# && cd /tmp/apache2-2.4.61 \ | ||
# && debuild || echo "no signature" | ||
RUN curl -o /root/.gdbinit https://raw.githubusercontent.com/php/php-src/master/.gdbinit | ||
RUN ulimit -c unlimited | ||
RUN mkdir -p /tmp/apache2-coredump \ | ||
&& chown -R www-data:www-data /tmp/apache2-coredump \ | ||
&& chmod 777 /tmp/apache2-coredump \ | ||
&& echo "CoreDumpDirectory /tmp/apache2-coredump" >> /etc/apache2/apache2.conf | ||
ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ | ||
RUN install-php-extensions gd xdebug | ||
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" | ||
RUN sed -i 's/max_execution_time = 30/max_execution_time = -1/g' "$PHP_INI_DIR/php.ini" | ||
RUN sed -i 's/max_input_time = 60/max_input_time = -1/g' "$PHP_INI_DIR/php.ini" | ||
RUN sed -i 's/memory_limit = 128M/memory_limit = -1/g' "$PHP_INI_DIR/php.ini" | ||
RUN echo "error_log = /var/www/html/data/php.log" >> "$PHP_INI_DIR/php.ini" | ||
RUN sed -i 's/#LogLevel info ssl:warn/LogLevel debug/g' /etc/apache2/sites-available/000-default.conf | ||
|
||
#COPY opcache-disabled.ini /usr/local/etc/php/conf.d/opcache-recommended.ini | ||
#COPY opcache-blacklist.txt /usr/local/etc/php/conf.d/opcache-blacklist.txt | ||
COPY xdebug.ini /tmp/xdebug.ini | ||
RUN if [[ "$INSTALL_XDEBUG" == "1" ]]; then \ | ||
install-php-extensions gd xdebug; \ | ||
mv /tmp/xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \ | ||
fi | ||
|
||
COPY opcache-disabled.ini /usr/local/etc/php/conf.d/opcache-recommended.ini | ||
COPY opcache-blacklist.txt /usr/local/etc/php/conf.d/opcache-blacklist.txt | ||
COPY xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
gdata/vaas/Authentication/ClientCredentialsGrantAuthenticator.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace VaasSdk\Authentication; | ||
|
||
class ClientCredentialsGrantAuthenticator | ||
{ | ||
private OAuth2TokenReceiver $_tokenReceiver; | ||
public function __construct( | ||
string $clientId, | ||
string $clientSecret, | ||
string $tokenEndpoint = "https://account.gdata.de/realms/vaas-production/protocol/openid-connect/token" | ||
) { | ||
$this->_tokenReceiver = new OAuth2TokenReceiver($tokenEndpoint, $clientId, $clientSecret); | ||
} | ||
|
||
public function getToken(): string | ||
{ | ||
return $this->_tokenReceiver->GetToken(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
|
||
namespace VaasSdk\Authentication; | ||
|
||
use Amp\Http\Client\Form; | ||
use Amp\Http\Client\HttpClient; | ||
use Amp\Http\Client\HttpClientBuilder; | ||
use Amp\Http\Client\Request; | ||
use Amp\TimeoutCancellation; | ||
use Exception; | ||
use VaasSdk\Exceptions\VaasAuthenticationException; | ||
|
||
class OAuth2TokenReceiver { | ||
private string $_tokenEndpoint; | ||
private string $_clientId; | ||
private string $_clientSecret; | ||
private string $_username; | ||
private string $_password; | ||
private string $_grantType; | ||
private Form $_formParams; | ||
private HttpClient $_browser; | ||
private int $_receiveTokenTimeout = 30; | ||
|
||
public function __construct( | ||
string $tokenEndpoint, string $clientId, string $clientSecret = "", | ||
string $username = "", string $password = "") | ||
{ | ||
$this->_browser = HttpClientBuilder::buildDefault(); | ||
$this->_tokenEndpoint = $tokenEndpoint; | ||
$this->_clientId = $clientId; | ||
$this->_clientSecret = $clientSecret; | ||
$this->_username = $username; | ||
$this->_password = $password; | ||
$this->_grantType = $this->_clientSecret == "" ? "password" : "client_credentials"; | ||
|
||
$this->_formParams = new Form(); | ||
$this->_formParams->addField('client_id', $this->_clientId); | ||
$this->_formParams->addField('grant_type', $this->_grantType); | ||
|
||
switch($this->_grantType) { | ||
case "password": | ||
$this->_formParams->addField('username', $this->_username); | ||
$this->_formParams->addField('password', $this->_password); | ||
break; | ||
case "client_credentials": | ||
$this->_formParams->addField('client_secret', $this->_clientSecret); | ||
break; | ||
default: | ||
throw new VaasAuthenticationException("Invalid grant type"); | ||
} | ||
} | ||
|
||
public function getToken() { | ||
try { | ||
$request = new Request($this->_tokenEndpoint, 'POST'); | ||
$request->addHeader('Content-Type', 'application/x-www-form-urlencoded'); | ||
$request->setBody($this->_formParams); | ||
$response = $this->_browser->request($request, new TimeoutCancellation($this->_receiveTokenTimeout)); | ||
if ($response->getStatus() != 200) { | ||
throw new VaasAuthenticationException($response->getReason(), $response->getStatus()); | ||
} | ||
} catch (Exception $e) { | ||
throw new VaasAuthenticationException($e->getMessage(), $e->getCode()); | ||
} | ||
$body = $response->getBody()->buffer(); | ||
$response_body = json_decode($body); | ||
return $response_body->access_token; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
gdata/vaas/Authentication/ResourceOwnerPasswordGrantAuthenticator.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace VaasSdk\Authentication; | ||
|
||
use VaasSdk\Authentication\OAuth2TokenReceiver; | ||
use VaasSdk\Exceptions\VaasAuthenticationException; | ||
|
||
class ResourceOwnerPasswordGrantAuthenticator { | ||
private OAuth2TokenReceiver $_tokenReceiver; | ||
|
||
public function __construct($clientId, $userName, $password, $tokenEndpoint) { | ||
$this->_tokenReceiver = new OAuth2TokenReceiver($tokenEndpoint, $clientId, "", $userName, $password); | ||
} | ||
|
||
/** | ||
* @throws VaasAuthenticationException | ||
*/ | ||
public function getToken() { | ||
return $this->_tokenReceiver->GetToken(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace VaasSdk\Exceptions; | ||
|
||
use Exception; | ||
|
||
class FileDoesNotExistException extends Exception | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace VaasSdk\Exceptions; | ||
|
||
use Exception; | ||
|
||
class InvalidSha256Exception extends Exception | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace VaasSdk\Exceptions; | ||
|
||
use Exception; | ||
|
||
class TimeoutException extends Exception | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace VaasSdk\Exceptions; | ||
|
||
use Exception; | ||
|
||
class UnknownKindException extends Exception | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace VaasSdk\Exceptions; | ||
|
||
use Exception; | ||
|
||
class UnkownVerdictException extends Exception | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace VaasSdk\Exceptions; | ||
|
||
use Exception; | ||
|
||
class UploadFailedException extends Exception | ||
{ | ||
function __construct(string $message, int $code) { | ||
parent::__construct($message, $code); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace VaasSdk\Exceptions; | ||
|
||
use Exception; | ||
|
||
class VaasAuthenticationException extends Exception | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace VaasSdk\Exceptions; | ||
|
||
use Exception; | ||
|
||
/** | ||
* The server encountered an internal error. | ||
* Recommended actions: | ||
* * You may retry the request after a certain delay. | ||
* * If the problem persists contact G DATA. | ||
*/ | ||
class VaasClientException extends Exception | ||
{ | ||
public function __construct(?string $message) | ||
{ | ||
if ($message == null) { | ||
parent::__construct("Client Error"); | ||
} else { | ||
parent::__construct($message); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace VaasSdk\Exceptions; | ||
|
||
use Exception; | ||
|
||
class VaasConnectionClosedException extends Exception | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace VaasSdk\Exceptions; | ||
|
||
use Exception; | ||
|
||
class VaasInvalidStateException extends Exception | ||
{ | ||
} |
Oops, something went wrong.