Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
StanBarrows committed Sep 23, 2024
1 parent 81b5220 commit 118715f
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .phpunit.cache/test-results

Large diffs are not rendered by default.

41 changes: 14 additions & 27 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,32 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
executionOrder="random"
failOnWarning="true"
failOnRisky="true"
failOnEmptyTestSuite="true"
beStrictAboutOutputDuringTests="true"
verbose="true"
>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd" backupGlobals="false"
bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false"
executionOrder="random" failOnWarning="true" failOnRisky="true" failOnEmptyTestSuite="true"
beStrictAboutOutputDuringTests="true" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<testsuites>
<testsuite name="codebar Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory suffix=".php">./src</directory>
</include>
<report>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
Expand All @@ -38,19 +21,23 @@
</logging>
<php>
<env name="APP_KEY" value="base64:F+mHMDBbavrsp/I3WYA5lDSwDJJI/0wQG4eM3csq/lo="/>
<env name="DOCUWARE_URL" value="https://domain.docuware.cloud"/>
<env name="DOCUWARE_USERNAME" value="[email protected]"/>
<env name="DOCUWARE_URL" value="https://laravel.docuware.cloud"/>
<env name="DOCUWARE_USERNAME" value="username"/>
<env name="DOCUWARE_PASSWORD" value="password"/>
<env name="DOCUWARE_PASSPHRASE" value="passphrase"/>
<env name="DOCUWARE_TIMEOUT" value="30"/>
<env name="DOCUWARE_CACHE_DRIVER" value="array" />
<env name="DOCUWARE_CACHE_DRIVER" value="file"/>
<env name="DOCUWARE_CACHE_LIFETIME_IN_SECONDS" value="0"/>

<env name="DOCUWARE_TESTS_FILE_CABINET_ID" value="17eaf4ba-41a8-43ec-8be5-80a5f5f1eaf1"/>
<env name="DOCUWARE_TESTS_DIALOG_ID" value="5afd9126-6cb1-4c7b-8ab2-2ca0bbbeb7be"/>
<env name="DOCUWARE_TESTS_BASKET_ID" value="b_ac921d68-983b-4b0f-8a20-34ab05ff19c6"/>
<env name="DOCUWARE_TESTS_ORGANIZATION_ID" value="1"/>
<env name="DOCUWARE_TESTS_GROUP_ID" value="ae49d31e-41ce-46b2-9ebb-64db58e90046"/>
<env name="DOCUWARE_TESTS_ROLE_ID" value="2444928d-1312-44db-aa79-101f198ac946"/>
</php>
</phpunit>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
4 changes: 4 additions & 0 deletions src/Connectors/DocuWareConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,14 @@ protected function defaultAuth(): TokenAuthenticator
*/
protected function getOrCreateNewOAuthToken(): string
{
//ray($this->configuration->identifier);

$cache = Cache::store($this->configuration->cacheDriver);

$cacheKey = 'docuware.oauth.'.$this->configuration->identifier;

//ray($cache->has($cacheKey),'hasCachkey?');

// Check if the token exists in cache and return it if found
if ($cache->has($cacheKey)) {
$token = Crypt::decrypt($cache->get($cacheKey));
Expand Down
5 changes: 1 addition & 4 deletions src/DTO/Config/ConfigWithCredentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

namespace CodebarAg\DocuWare\DTO\Config;

use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\Hash;

final class ConfigWithCredentials
{
public string $identifier;
Expand Down Expand Up @@ -55,6 +52,6 @@ public function __construct(

$this->scope = filled($scope) ? $scope : config('laravel-docuware.configurations.scope');

$this->identifier = Hash::make($this->url.$this->username.Crypt::encrypt($this->password));
$this->identifier = hash('sha256', $this->url.$this->username.$this->password);
}
}
5 changes: 1 addition & 4 deletions src/DTO/Config/ConfigWithCredentialsTrustedUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

namespace CodebarAg\DocuWare\DTO\Config;

use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\Hash;

final class ConfigWithCredentialsTrustedUser
{
public string $identifier;
Expand Down Expand Up @@ -59,6 +56,6 @@ public function __construct(

$this->scope = filled($scope) ? $scope : config('laravel-docuware.configurations.scope');

$this->identifier = Hash::make($this->url.$this->username.Crypt::encrypt($this->password));
$this->identifier = hash('sha256', $this->url.$this->username.$this->password);
}
}
2 changes: 0 additions & 2 deletions src/Facades/DocuWare.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Carbon\Carbon;
use CodebarAg\DocuWare\DocuWareSearchRequestBuilder;
use CodebarAg\DocuWare\DocuWareUrl;
use CodebarAg\DocuWare\DTO\Cookie;
use CodebarAg\DocuWare\DTO\Documents\Document;
use CodebarAg\DocuWare\DTO\Documents\DocumentThumbnail;
use CodebarAg\DocuWare\DTO\Documents\Field;
Expand All @@ -19,7 +18,6 @@
/**
* @see \CodebarAg\DocuWare\DocuWare
*
* @method static Cookie cookie(string $url, string $username, string $password, $rememberMe = false, $redirectToMyselfInCaseOfError = false, $licenseType = null)
* @method static string login()
* @method static void logout()
* @method static Organization getOrganization(string $organizationId)
Expand Down

0 comments on commit 118715f

Please sign in to comment.