lots of improvements
This commit is contained in:
116
shared/lib/Resource/Provider/Node/NodeBaseAbstract.php
Normal file
116
shared/lib/Resource/Provider/Node/NodeBaseAbstract.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider\Node;
|
||||
|
||||
use DateTimeImmutable;
|
||||
|
||||
/**
|
||||
* Abstract Node Base Class
|
||||
*
|
||||
* Provides common implementation for all resource nodes
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
abstract class NodeBaseAbstract implements NodeBaseInterface {
|
||||
|
||||
/**
|
||||
* Internal data storage
|
||||
*/
|
||||
protected array $data = [];
|
||||
|
||||
public function __construct(
|
||||
protected readonly string $provider,
|
||||
protected readonly string|int $service,
|
||||
) {
|
||||
$this->data = [
|
||||
static::JSON_PROPERTY_PROVIDER => $this->provider,
|
||||
static::JSON_PROPERTY_SERVICE => $this->service,
|
||||
static::JSON_PROPERTY_COLLECTION => null,
|
||||
static::JSON_PROPERTY_IDENTIFIER => null,
|
||||
static::JSON_PROPERTY_SIGNATURE => null,
|
||||
static::JSON_PROPERTY_CREATED => null,
|
||||
static::JSON_PROPERTY_MODIFIED => null,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function type(): string {
|
||||
return static::RESOURCE_TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function provider(): string {
|
||||
return $this->data[static::JSON_PROPERTY_PROVIDER];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function service(): string|int {
|
||||
return $this->data[static::JSON_PROPERTY_SERVICE];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function collection(): string|int|null {
|
||||
return $this->data[static::JSON_PROPERTY_COLLECTION] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function identifier(): string|int|null {
|
||||
return $this->data[static::JSON_PROPERTY_IDENTIFIER] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function signature(): string|null {
|
||||
return $this->data[static::JSON_PROPERTY_SIGNATURE] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function created(): DateTimeImmutable|null {
|
||||
return isset($this->data[static::JSON_PROPERTY_CREATED])
|
||||
? new DateTimeImmutable($this->data[static::JSON_PROPERTY_CREATED])
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function modified(): DateTimeImmutable|null {
|
||||
return isset($this->data[static::JSON_PROPERTY_MODIFIED])
|
||||
? new DateTimeImmutable($this->data[static::JSON_PROPERTY_MODIFIED])
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function jsonSerialize(): array {
|
||||
$data = $this->data;
|
||||
$data[static::JSON_PROPERTY_PROPERTIES] = $this->getProperties()->jsonSerialize();
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
abstract public function getProperties(): NodePropertiesBaseInterface;
|
||||
}
|
||||
95
shared/lib/Resource/Provider/Node/NodeBaseInterface.php
Normal file
95
shared/lib/Resource/Provider/Node/NodeBaseInterface.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider\Node;
|
||||
|
||||
use DateTimeImmutable;
|
||||
use KTXF\Json\JsonSerializable;
|
||||
|
||||
/**
|
||||
* Resource Node Read Interface
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
interface NodeBaseInterface extends JsonSerializable {
|
||||
|
||||
public const RESOURCE_TYPE = 'resource.node';
|
||||
public const JSON_PROPERTY_PROVIDER = 'provider';
|
||||
public const JSON_PROPERTY_SERVICE = 'service';
|
||||
public const JSON_PROPERTY_COLLECTION = 'collection';
|
||||
public const JSON_PROPERTY_IDENTIFIER = 'identifier';
|
||||
public const JSON_PROPERTY_SIGNATURE = 'signature';
|
||||
public const JSON_PROPERTY_CREATED = 'created';
|
||||
public const JSON_PROPERTY_MODIFIED = 'modified';
|
||||
public const JSON_PROPERTY_PROPERTIES = 'properties';
|
||||
|
||||
/**
|
||||
* Node type
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function type(): string;
|
||||
|
||||
/**
|
||||
* Provider identifier
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function provider(): string;
|
||||
|
||||
/**
|
||||
* Service identifier
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function service(): string|int;
|
||||
|
||||
/**
|
||||
* Collection identifier
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function collection(): string|int|null;
|
||||
|
||||
/**
|
||||
* Node identifier
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function identifier(): string|int|null;
|
||||
|
||||
/**
|
||||
* Node signature/sync token
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function signature(): string|null;
|
||||
|
||||
/**
|
||||
* Node creation date
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function created(): DateTimeImmutable|null;
|
||||
|
||||
/**
|
||||
* Node modification date
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function modified(): DateTimeImmutable|null;
|
||||
|
||||
/**
|
||||
* Get the node properties
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getProperties(): NodePropertiesBaseInterface|NodePropertiesMutableInterface;
|
||||
|
||||
}
|
||||
95
shared/lib/Resource/Provider/Node/NodeMutableAbstract.php
Normal file
95
shared/lib/Resource/Provider/Node/NodeMutableAbstract.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider\Node;
|
||||
|
||||
/**
|
||||
* Abstract Node Mutable Class
|
||||
*
|
||||
* Provides common implementation for mutable resource nodes
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
abstract class NodeMutableAbstract extends NodeBaseAbstract implements NodeMutableInterface {
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function jsonDeserialize(array|string $data): static {
|
||||
if (is_string($data)) {
|
||||
$data = json_decode($data, true);
|
||||
}
|
||||
|
||||
$this->data = [];
|
||||
|
||||
if (isset($data[static::JSON_PROPERTY_COLLECTION])) {
|
||||
if (!is_string($data[static::JSON_PROPERTY_COLLECTION]) && !is_int($data[static::JSON_PROPERTY_COLLECTION])) {
|
||||
throw new \InvalidArgumentException("Collection must be a string or integer");
|
||||
}
|
||||
$this->data[static::JSON_PROPERTY_COLLECTION] = $data[static::JSON_PROPERTY_COLLECTION];
|
||||
} else {
|
||||
$this->data[static::JSON_PROPERTY_COLLECTION] = null;
|
||||
}
|
||||
|
||||
if (isset($data[static::JSON_PROPERTY_IDENTIFIER])) {
|
||||
if (!is_string($data[static::JSON_PROPERTY_IDENTIFIER]) && !is_int($data[static::JSON_PROPERTY_IDENTIFIER])) {
|
||||
throw new \InvalidArgumentException("Identifier must be a string or integer");
|
||||
}
|
||||
$this->data[static::JSON_PROPERTY_IDENTIFIER] = $data[static::JSON_PROPERTY_IDENTIFIER];
|
||||
} else {
|
||||
$this->data[static::JSON_PROPERTY_IDENTIFIER] = null;
|
||||
}
|
||||
|
||||
if (isset($data[static::JSON_PROPERTY_SIGNATURE])) {
|
||||
if (!is_string($data[static::JSON_PROPERTY_SIGNATURE]) && !is_int($data[static::JSON_PROPERTY_SIGNATURE])) {
|
||||
throw new \InvalidArgumentException("Signature must be a string or integer");
|
||||
}
|
||||
$this->data[static::JSON_PROPERTY_SIGNATURE] = $data[static::JSON_PROPERTY_SIGNATURE];
|
||||
} else {
|
||||
$this->data[static::JSON_PROPERTY_SIGNATURE] = null;
|
||||
}
|
||||
|
||||
if (isset($data[static::JSON_PROPERTY_CREATED])) {
|
||||
if (!is_string($data[static::JSON_PROPERTY_CREATED])) {
|
||||
throw new \InvalidArgumentException("Created date must be a string in ISO 8601 format");
|
||||
}
|
||||
$this->data[static::JSON_PROPERTY_CREATED] = $data[static::JSON_PROPERTY_CREATED];
|
||||
} else {
|
||||
$this->data[static::JSON_PROPERTY_CREATED] = null;
|
||||
}
|
||||
|
||||
if (isset($data[static::JSON_PROPERTY_MODIFIED])) {
|
||||
if (!is_string($data[static::JSON_PROPERTY_MODIFIED])) {
|
||||
throw new \InvalidArgumentException("Modified date must be a string in ISO 8601 format");
|
||||
}
|
||||
$this->data[static::JSON_PROPERTY_MODIFIED] = $data[static::JSON_PROPERTY_MODIFIED];
|
||||
} else {
|
||||
$this->data[static::JSON_PROPERTY_MODIFIED] = null;
|
||||
}
|
||||
|
||||
if (isset($data[static::JSON_PROPERTY_PROPERTIES])) {
|
||||
if (!is_array($data[static::JSON_PROPERTY_PROPERTIES])) {
|
||||
throw new \InvalidArgumentException("Properties must be an array");
|
||||
}
|
||||
$this->getProperties()->jsonDeserialize($data[static::JSON_PROPERTY_PROPERTIES]);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
abstract public function getProperties(): NodePropertiesMutableInterface;
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
abstract public function setProperties(NodePropertiesMutableInterface $value): static;
|
||||
}
|
||||
35
shared/lib/Resource/Provider/Node/NodeMutableInterface.php
Normal file
35
shared/lib/Resource/Provider/Node/NodeMutableInterface.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider\Node;
|
||||
|
||||
use KTXF\Json\JsonDeserializable;
|
||||
|
||||
/**
|
||||
* Node Mutable Write Interface
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
interface NodeMutableInterface extends NodeBaseInterface, JsonDeserializable {
|
||||
|
||||
/**
|
||||
* Get the node properties
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getProperties(): NodePropertiesMutableInterface;
|
||||
|
||||
/**
|
||||
* Sets the node properties
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function setProperties(NodePropertiesMutableInterface $value): static;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider\Node;
|
||||
|
||||
/**
|
||||
* Abstract Node Properties Base Class
|
||||
*
|
||||
* Provides common implementation for node properties
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
abstract class NodePropertiesBaseAbstract implements NodePropertiesBaseInterface {
|
||||
|
||||
protected array $data = [];
|
||||
|
||||
public function __construct(array $data) {
|
||||
|
||||
if (!isset($data[static::JSON_PROPERTY_TYPE])) {
|
||||
$data[static::JSON_PROPERTY_TYPE] = static::JSON_TYPE;
|
||||
}
|
||||
|
||||
if (!isset($data[static::JSON_PROPERTY_VERSION])) {
|
||||
$data[static::JSON_PROPERTY_VERSION] = 1;
|
||||
}
|
||||
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function jsonSerialize(): array {
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function type(): string {
|
||||
return $this->data[static::JSON_PROPERTY_TYPE];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function version(): int {
|
||||
return $this->data[static::JSON_PROPERTY_VERSION];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider\Node;
|
||||
|
||||
use JsonSerializable;
|
||||
|
||||
/**
|
||||
* Resource Node Properties Read Interface
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
interface NodePropertiesBaseInterface extends JsonSerializable {
|
||||
|
||||
public const RESOURCE_TYPE = 'resource.data';
|
||||
|
||||
public const JSON_TYPE = 'resource.data';
|
||||
public const JSON_PROPERTY_TYPE = '@type';
|
||||
public const JSON_PROPERTY_VERSION = 'version';
|
||||
|
||||
/**
|
||||
* Get resource node properties type
|
||||
*/
|
||||
public function type(): string;
|
||||
|
||||
/**
|
||||
* Get resource node properties version
|
||||
*/
|
||||
public function version(): int;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider\Node;
|
||||
|
||||
/**
|
||||
* Abstract Node Properties Mutable Class
|
||||
*
|
||||
* Provides common implementation for mutable node properties
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
abstract class NodePropertiesMutableAbstract extends NodePropertiesBaseAbstract implements NodePropertiesMutableInterface {
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function jsonDeserialize(array|string $data): static {
|
||||
if (is_string($data)) {
|
||||
$data = json_decode($data, true);
|
||||
}
|
||||
|
||||
$this->data = $data;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider\Node;
|
||||
|
||||
use KTXF\Json\JsonDeserializable;
|
||||
|
||||
/**
|
||||
* Resource Node Properties Mutable Interface
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
interface NodePropertiesMutableInterface extends NodePropertiesBaseInterface, JsonDeserializable {
|
||||
|
||||
}
|
||||
@@ -22,7 +22,7 @@ interface ResourceProviderBaseInterface extends ProviderInterface, JsonSerializa
|
||||
|
||||
public const JSON_TYPE = 'resource.provider';
|
||||
public const JSON_PROPERTY_TYPE = '@type';
|
||||
public const JSON_PROPERTY_ID = 'id';
|
||||
public const JSON_PROPERTY_IDENTIFIER = 'identifier';
|
||||
public const JSON_PROPERTY_LABEL = 'label';
|
||||
public const JSON_PROPERTY_CAPABILITIES = 'capabilities';
|
||||
|
||||
|
||||
@@ -11,10 +11,14 @@ interface ResourceServiceBaseInterface extends JsonSerializable {
|
||||
// JSON Constants
|
||||
public const JSON_TYPE = 'resource.service';
|
||||
public const JSON_PROPERTY_TYPE = '@type';
|
||||
public const JSON_PROPERTY_ID = 'id';
|
||||
public const JSON_PROPERTY_PROVIDER = 'provider';
|
||||
public const JSON_PROPERTY_IDENTIFIER = 'identifier';
|
||||
public const JSON_PROPERTY_LABEL = 'label';
|
||||
public const JSON_PROPERTY_ENABLED = 'enabled';
|
||||
public const JSON_PROPERTY_CAPABILITIES = 'capabilities';
|
||||
public const JSON_PROPERTY_LOCATION = 'location';
|
||||
public const JSON_PROPERTY_IDENTITY = 'identity';
|
||||
public const JSON_PROPERTY_AUXILIARY = 'auxiliary';
|
||||
|
||||
/**
|
||||
* Confirms if specific capability is supported
|
||||
@@ -41,21 +45,21 @@ interface ResourceServiceBaseInterface extends JsonSerializable {
|
||||
*
|
||||
* @since 2025.11.01
|
||||
*/
|
||||
public function in(): string;
|
||||
public function provider(): string;
|
||||
|
||||
/**
|
||||
* Unique arbitrary text string identifying this service (e.g. 1 or service1 or anything else)
|
||||
*
|
||||
* @since 2025.11.01
|
||||
*/
|
||||
public function id(): string|int;
|
||||
public function identifier(): string|int;
|
||||
|
||||
/**
|
||||
* Gets the localized human friendly name of this service (e.g. ACME Company File Service)
|
||||
*
|
||||
* @since 2025.11.01
|
||||
*/
|
||||
public function getLabel(): string;
|
||||
public function getLabel(): string|null;
|
||||
|
||||
/**
|
||||
* Gets the active status of this service
|
||||
@@ -82,4 +86,13 @@ interface ResourceServiceBaseInterface extends JsonSerializable {
|
||||
*/
|
||||
public function getIdentity(): ResourceServiceIdentityInterface;
|
||||
|
||||
/**
|
||||
* Gets the auxiliary information of this service
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAuxiliary(): array;
|
||||
|
||||
}
|
||||
|
||||
@@ -30,6 +30,15 @@ interface ResourceServiceConfigureInterface extends ResourceServiceMutateInterfa
|
||||
*/
|
||||
public function setLocation(ResourceServiceLocationInterface $value): self;
|
||||
|
||||
/**
|
||||
* Gets a fresh instance of the location/configuration of this service
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return ResourceServiceLocationInterface
|
||||
*/
|
||||
public function freshLocation(string|null $type, array $data = []): ResourceServiceLocationInterface;
|
||||
|
||||
/**
|
||||
* Sets the identity used for this service
|
||||
*
|
||||
@@ -41,4 +50,13 @@ interface ResourceServiceConfigureInterface extends ResourceServiceMutateInterfa
|
||||
*/
|
||||
public function setIdentity(ResourceServiceIdentityInterface $value): self;
|
||||
|
||||
/**
|
||||
* Gets a fresh instance of the identity used for this service
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return ResourceServiceIdentityInterface
|
||||
*/
|
||||
public function freshIdentity(string|null $type, array $data = []): ResourceServiceIdentityInterface;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider;
|
||||
|
||||
/**
|
||||
* Resource Service Identity Certificate
|
||||
*
|
||||
* Client certificate authentication credentials for resource services.
|
||||
* Uses X.509 certificates for mutual TLS (mTLS) authentication.
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
interface ResourceServiceIdentityCertificate extends ResourceServiceIdentityInterface {
|
||||
|
||||
/**
|
||||
* Gets the certificate file path or content
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return string Path to certificate file or PEM-encoded certificate
|
||||
*/
|
||||
public function getCertificate(): string;
|
||||
|
||||
/**
|
||||
* Sets the certificate file path or content
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $value Path to certificate file or PEM-encoded certificate
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setCertificate(string $value): void;
|
||||
|
||||
/**
|
||||
* Gets the private key file path or content
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return string Path to private key file or PEM-encoded private key
|
||||
*/
|
||||
public function getPrivateKey(): string;
|
||||
|
||||
/**
|
||||
* Sets the private key file path or content
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $value Path to private key file or PEM-encoded private key
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPrivateKey(string $value): void;
|
||||
|
||||
/**
|
||||
* Gets the private key passphrase (if encrypted)
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return string|null Passphrase for encrypted private key, or null if not encrypted
|
||||
*/
|
||||
public function getPassphrase(): ?string;
|
||||
|
||||
/**
|
||||
* Sets the private key passphrase (if encrypted)
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string|null $value Passphrase for encrypted private key
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPassphrase(?string $value): void;
|
||||
|
||||
}
|
||||
@@ -22,15 +22,16 @@ interface ResourceServiceIdentityInterface extends JsonSerializable {
|
||||
|
||||
public const TYPE_NONE = 'NA';
|
||||
public const TYPE_BASIC = 'BA';
|
||||
public const TYPE_BEARER = 'BR';
|
||||
public const TYPE_TOKEN = 'TA';
|
||||
public const TYPE_OAUTH = 'OA';
|
||||
public const TYPE_CERTIFICATE = 'CC';
|
||||
|
||||
/**
|
||||
* Gets the identity/authentication type
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return string One of: TYPE_NONE, TYPE_BASIC, TYPE_BEARER, TYPE_OAUTH
|
||||
* @return string One of: TYPE_NONE, TYPE_BASIC, TYPE_TOKEN, TYPE_OAUTH, TYPE_CERTIFICATE
|
||||
*/
|
||||
public function type(): string;
|
||||
|
||||
|
||||
@@ -10,16 +10,17 @@ declare(strict_types=1);
|
||||
namespace KTXF\Resource\Provider;
|
||||
|
||||
/**
|
||||
* Resource Service Identity Bearer
|
||||
* Resource Service Identity Token
|
||||
*
|
||||
* Bearer token authentication credentials for resource services.
|
||||
* Token authentication credentials for resource services.
|
||||
* Uses a single static token/key for authentication.
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
interface ResourceServiceIdentityBearer extends ResourceServiceIdentityInterface {
|
||||
interface ResourceServiceIdentityToken extends ResourceServiceIdentityInterface {
|
||||
|
||||
/**
|
||||
* Gets the bearer token
|
||||
* Gets the authentication token
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
@@ -28,7 +29,7 @@ interface ResourceServiceIdentityBearer extends ResourceServiceIdentityInterface
|
||||
public function getToken(): string;
|
||||
|
||||
/**
|
||||
* Sets the bearer token
|
||||
* Sets the authentication token
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
@@ -43,4 +43,15 @@ interface ResourceServiceMutateInterface extends ResourceServiceBaseInterface, J
|
||||
*/
|
||||
public function setEnabled(bool $value): self;
|
||||
|
||||
/**
|
||||
* Sets the auxiliary information of this service
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param array $value Arbitrary key-value pairs for additional service info
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setAuxiliary(array $value): self;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user