Skip to content

Commit 118715f

Browse files
committed
WIP
1 parent 81b5220 commit 118715f

File tree

6 files changed

+21
-38
lines changed

6 files changed

+21
-38
lines changed

.phpunit.cache/test-results

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

phpunit.xml.dist

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,15 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
5-
backupGlobals="false"
6-
backupStaticAttributes="false"
7-
bootstrap="vendor/autoload.php"
8-
colors="true"
9-
convertErrorsToExceptions="true"
10-
convertNoticesToExceptions="true"
11-
convertWarningsToExceptions="true"
12-
processIsolation="false"
13-
stopOnFailure="false"
14-
executionOrder="random"
15-
failOnWarning="true"
16-
failOnRisky="true"
17-
failOnEmptyTestSuite="true"
18-
beStrictAboutOutputDuringTests="true"
19-
verbose="true"
20-
>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd" backupGlobals="false"
4+
bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false"
5+
executionOrder="random" failOnWarning="true" failOnRisky="true" failOnEmptyTestSuite="true"
6+
beStrictAboutOutputDuringTests="true" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
217
<testsuites>
228
<testsuite name="codebar Test Suite">
239
<directory>tests</directory>
2410
</testsuite>
2511
</testsuites>
2612
<coverage>
27-
<include>
28-
<directory suffix=".php">./src</directory>
29-
</include>
3013
<report>
3114
<html outputDirectory="build/coverage"/>
3215
<text outputFile="build/coverage.txt"/>
@@ -38,19 +21,23 @@
3821
</logging>
3922
<php>
4023
<env name="APP_KEY" value="base64:F+mHMDBbavrsp/I3WYA5lDSwDJJI/0wQG4eM3csq/lo="/>
41-
<env name="DOCUWARE_URL" value="https://domain.docuware.cloud"/>
42-
<env name="DOCUWARE_USERNAME" value="[email protected]"/>
24+
<env name="DOCUWARE_URL" value="https://laravel.docuware.cloud"/>
25+
<env name="DOCUWARE_USERNAME" value="username"/>
4326
<env name="DOCUWARE_PASSWORD" value="password"/>
4427
<env name="DOCUWARE_PASSPHRASE" value="passphrase"/>
4528
<env name="DOCUWARE_TIMEOUT" value="30"/>
46-
<env name="DOCUWARE_CACHE_DRIVER" value="array" />
29+
<env name="DOCUWARE_CACHE_DRIVER" value="file"/>
4730
<env name="DOCUWARE_CACHE_LIFETIME_IN_SECONDS" value="0"/>
48-
4931
<env name="DOCUWARE_TESTS_FILE_CABINET_ID" value="17eaf4ba-41a8-43ec-8be5-80a5f5f1eaf1"/>
5032
<env name="DOCUWARE_TESTS_DIALOG_ID" value="5afd9126-6cb1-4c7b-8ab2-2ca0bbbeb7be"/>
5133
<env name="DOCUWARE_TESTS_BASKET_ID" value="b_ac921d68-983b-4b0f-8a20-34ab05ff19c6"/>
5234
<env name="DOCUWARE_TESTS_ORGANIZATION_ID" value="1"/>
5335
<env name="DOCUWARE_TESTS_GROUP_ID" value="ae49d31e-41ce-46b2-9ebb-64db58e90046"/>
5436
<env name="DOCUWARE_TESTS_ROLE_ID" value="2444928d-1312-44db-aa79-101f198ac946"/>
5537
</php>
56-
</phpunit>
38+
<source>
39+
<include>
40+
<directory suffix=".php">./src</directory>
41+
</include>
42+
</source>
43+
</phpunit>

src/Connectors/DocuWareConnector.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,14 @@ protected function defaultAuth(): TokenAuthenticator
5757
*/
5858
protected function getOrCreateNewOAuthToken(): string
5959
{
60+
//ray($this->configuration->identifier);
61+
6062
$cache = Cache::store($this->configuration->cacheDriver);
6163

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

66+
//ray($cache->has($cacheKey),'hasCachkey?');
67+
6468
// Check if the token exists in cache and return it if found
6569
if ($cache->has($cacheKey)) {
6670
$token = Crypt::decrypt($cache->get($cacheKey));

src/DTO/Config/ConfigWithCredentials.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
namespace CodebarAg\DocuWare\DTO\Config;
44

5-
use Illuminate\Support\Facades\Crypt;
6-
use Illuminate\Support\Facades\Hash;
7-
85
final class ConfigWithCredentials
96
{
107
public string $identifier;
@@ -55,6 +52,6 @@ public function __construct(
5552

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

58-
$this->identifier = Hash::make($this->url.$this->username.Crypt::encrypt($this->password));
55+
$this->identifier = hash('sha256', $this->url.$this->username.$this->password);
5956
}
6057
}

src/DTO/Config/ConfigWithCredentialsTrustedUser.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
namespace CodebarAg\DocuWare\DTO\Config;
44

5-
use Illuminate\Support\Facades\Crypt;
6-
use Illuminate\Support\Facades\Hash;
7-
85
final class ConfigWithCredentialsTrustedUser
96
{
107
public string $identifier;
@@ -59,6 +56,6 @@ public function __construct(
5956

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

62-
$this->identifier = Hash::make($this->url.$this->username.Crypt::encrypt($this->password));
59+
$this->identifier = hash('sha256', $this->url.$this->username.$this->password);
6360
}
6461
}

src/Facades/DocuWare.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use Carbon\Carbon;
66
use CodebarAg\DocuWare\DocuWareSearchRequestBuilder;
77
use CodebarAg\DocuWare\DocuWareUrl;
8-
use CodebarAg\DocuWare\DTO\Cookie;
98
use CodebarAg\DocuWare\DTO\Documents\Document;
109
use CodebarAg\DocuWare\DTO\Documents\DocumentThumbnail;
1110
use CodebarAg\DocuWare\DTO\Documents\Field;
@@ -19,7 +18,6 @@
1918
/**
2019
* @see \CodebarAg\DocuWare\DocuWare
2120
*
22-
* @method static Cookie cookie(string $url, string $username, string $password, $rememberMe = false, $redirectToMyselfInCaseOfError = false, $licenseType = null)
2321
* @method static string login()
2422
* @method static void logout()
2523
* @method static Organization getOrganization(string $organizationId)

0 commit comments

Comments
 (0)