FederatedEventService
extends NCSignature
in package
Uses
TNCRequest, TStringTools
Class FederatedEventService
Table of Contents
- DATE_HEADER = 'D, d M Y H:i:s T'
- DATE_OBJECT = 'Y-m-d\\TH:i:s\\Z'
- DATE_TTL = 300
- $configService : ConfigService
- $dateHeader : mixed
- $eventService : EventService
- $eventWrapperRequest : EventWrapperRequest
- $interfaceService : InterfaceService
- $memberRequest : MemberRequest
- $remoteRequest : RemoteRequest
- $remoteUpstreamService : RemoteUpstreamService
- $shareLockRequest : ShareLockRequest
- $ttl : int
- __construct() : mixed
- FederatedEventService constructor.
- clientService() : IClientService
- confirmInitiator() : void
- This confirmation is optional, method is just here to avoid going too far away on the process
- doRequest() : void
- downloadSignatory() : void
- generateKeys() : mixed
- generateRandomSentence() : string
- generateRandomWord() : string
- getDateDiff() : string
- getFederatedItem() : IFederatedItem
- getInstances() : array<string|int, RemoteInstance>
- getKeyOrigin() : string
- getOpenSSLAlgo() : int
- humanReadable() : string
- incomingSignedRequest() : NCSignedRequest
- initBroadcast() : bool
- async the process, generate a local request that will be closed.
- manageResults() : void
- should be used to manage results from events, like sending mails on user creation
- newEvent() : array<string|int, mixed>
- Called when creating a new Event.
- retrieveJson() : array<string|int, mixed>
- retrieveSignatory() : NCSignatory
- return Signatory by its Id from cache or from direct request.
- setMaxDownloadSize() : mixed
- signOutgoingRequest() : NCSignedRequest
- signString() : string
- updateSignatory() : void
- verifyString() : mixed
- commonPart() : string
- cut() : string
- feedStringWithParams() : string
- isUuid() : bool
- token() : string
- uuid() : string
- Generate uuid: 2b5a7a87-8db1-445f-a17b-405790f91c80
- configureEvent() : mixed
- confirmRequiredCondition() : mixed
- Some event might require additional check
- confirmSharedItem() : void
- generationClientOptions() : mixed
- getChosenEncryption() : string
- getUsedEncryption() : string
- parseIncomingSignatureHeader() : void
- setFederatedEventBypass() : mixed
- Some event might need to bypass some checks
- setIncomingClearSignature() : void
- setIncomingSignatureHeader() : void
- setOutgoingClearSignature() : void
- setOutgoingSignatureHeader() : void
- setOutgoingSignedSignature() : void
- signingOutgoingRequest() : void
- useClient() : IResponse
- verifyIncomingRequestContent() : void
- verifyIncomingRequestSignature() : mixed
- verifyIncomingRequestTime() : void
- verifySignedRequest() : mixed
Constants
DATE_HEADER
public
mixed
DATE_HEADER
= 'D, d M Y H:i:s T'
DATE_OBJECT
public
mixed
DATE_OBJECT
= 'Y-m-d\\TH:i:s\\Z'
DATE_TTL
public
mixed
DATE_TTL
= 300
Properties
$configService
private
ConfigService
$configService
$dateHeader
private
mixed
$dateHeader
= self::DATE_HEADER
$eventService
private
EventService
$eventService
$eventWrapperRequest
private
EventWrapperRequest
$eventWrapperRequest
$interfaceService
private
InterfaceService
$interfaceService
$memberRequest
private
MemberRequest
$memberRequest
$remoteRequest
private
RemoteRequest
$remoteRequest
$remoteUpstreamService
private
RemoteUpstreamService
$remoteUpstreamService
$shareLockRequest
private
ShareLockRequest
$shareLockRequest
$ttl
private
int
$ttl
= self::DATE_TTL
Methods
__construct()
FederatedEventService constructor.
public
__construct(EventWrapperRequest $eventWrapperRequest, RemoteRequest $remoteRequest, MemberRequest $memberRequest, ShareLockRequest $shareLockRequest, RemoteUpstreamService $remoteUpstreamService, EventService $eventService, InterfaceService $interfaceService, ConfigService $configService) : mixed
Parameters
- $eventWrapperRequest : EventWrapperRequest
- $remoteRequest : RemoteRequest
- $memberRequest : MemberRequest
- $shareLockRequest : ShareLockRequest
- $remoteUpstreamService : RemoteUpstreamService
- $eventService : EventService
- $interfaceService : InterfaceService
- $configService : ConfigService
Return values
mixed —clientService()
public
clientService() : IClientService
Return values
IClientService —confirmInitiator()
This confirmation is optional, method is just here to avoid going too far away on the process
public
confirmInitiator(FederatedEvent $event[, bool $local = false ]) : void
Parameters
- $event : FederatedEvent
- $local : bool = false
Tags
Return values
void —doRequest()
public
doRequest(NCRequest $request[, bool $exceptionOnIssue = true ]) : void
Parameters
- $request : NCRequest
- $exceptionOnIssue : bool = true
Tags
Return values
void —downloadSignatory()
public
downloadSignatory(NCSignatory $signatory[, string $keyId = '' ][, array<string|int, mixed> $params = [] ][, NCRequest|null $request = null ]) : void
Parameters
- $signatory : NCSignatory
- $keyId : string = ''
- $params : array<string|int, mixed> = []
- $request : NCRequest|null = null
Tags
Return values
void —generateKeys()
public
generateKeys(NCSignatory $signatory[, string $digest = 'rsa' ][, int $bits = 2048 ][, int $type = OPENSSL_KEYTYPE_RSA ]) : mixed
Parameters
- $signatory : NCSignatory
- $digest : string = 'rsa'
- $bits : int = 2048
- $type : int = OPENSSL_KEYTYPE_RSA
Return values
mixed —generateRandomSentence()
public
generateRandomSentence([int $words = 5 ]) : string
Parameters
- $words : int = 5
Return values
string —generateRandomWord()
public
generateRandomWord([int $length = 8 ]) : string
Parameters
- $length : int = 8
Return values
string —getDateDiff()
public
getDateDiff(int $first, int $second[, bool $short = false ][, array<string|int, mixed> $words = [] ]) : string
Parameters
- $first : int
- $second : int
- $short : bool = false
- $words : array<string|int, mixed> = []
Tags
Return values
string —getFederatedItem()
public
getFederatedItem(FederatedEvent $event[, bool $checkLocalOnly = true ]) : IFederatedItem
Parameters
- $event : FederatedEvent
- $checkLocalOnly : bool = true
Tags
Return values
IFederatedItem —getInstances()
public
getInstances(FederatedEvent $event) : array<string|int, RemoteInstance>
Parameters
- $event : FederatedEvent
Tags
Return values
array<string|int, RemoteInstance> —getKeyOrigin()
public
getKeyOrigin(string $keyId) : string
Parameters
- $keyId : string
Tags
Return values
string —getOpenSSLAlgo()
public
getOpenSSLAlgo(NCSignatory $signatory) : int
Parameters
- $signatory : NCSignatory
Return values
int —humanReadable()
public
humanReadable(int $bytes) : string
Parameters
- $bytes : int
Return values
string —incomingSignedRequest()
public
incomingSignedRequest([string $body = '' ]) : NCSignedRequest
Parameters
- $body : string = ''
Tags
Return values
NCSignedRequest —initBroadcast()
async the process, generate a local request that will be closed.
public
initBroadcast(FederatedEvent $event) : bool
Parameters
- $event : FederatedEvent
Tags
Return values
bool —manageResults()
should be used to manage results from events, like sending mails on user creation
public
manageResults(string $token) : void
Parameters
- $token : string
Return values
void —newEvent()
Called when creating a new Event.
public
newEvent(FederatedEvent $event) : array<string|int, mixed>
This method will manage the event locally and upstream the payload if needed.
Parameters
- $event : FederatedEvent
Tags
Return values
array<string|int, mixed> —retrieveJson()
public
retrieveJson(NCRequest $request) : array<string|int, mixed>
Parameters
- $request : NCRequest
Tags
Return values
array<string|int, mixed> —retrieveSignatory()
return Signatory by its Id from cache or from direct request.
public
retrieveSignatory(string $keyId[, bool $refresh = false ]) : NCSignatory
Should be overwritten.
Parameters
- $keyId : string
- $refresh : bool = false
Tags
Return values
NCSignatory —setMaxDownloadSize()
public
setMaxDownloadSize(int $size) : mixed
Parameters
- $size : int
Return values
mixed —signOutgoingRequest()
public
signOutgoingRequest(NCRequest $request, NCSignatory $signatory) : NCSignedRequest
Parameters
- $request : NCRequest
- $signatory : NCSignatory
Tags
Return values
NCSignedRequest —signString()
public
signString(string $clear, NCSignatory $signatory) : string
Parameters
- $clear : string
- $signatory : NCSignatory
Tags
Return values
string —updateSignatory()
public
updateSignatory(NCSignatory $signatory, array<string|int, mixed> $json[, string $keyId = '' ]) : void
Parameters
- $signatory : NCSignatory
- $json : array<string|int, mixed>
- $keyId : string = ''
Tags
Return values
void —verifyString()
public
verifyString(string $clear, string $signed, string $publicKey[, string $algo = NCSignatory::SHA256 ]) : mixed
Parameters
- $clear : string
- $signed : string
- $publicKey : string
- $algo : string = NCSignatory::SHA256
Tags
Return values
mixed —commonPart()
protected
commonPart(string $str1, string $str2[, bool $cs = true ]) : string
Parameters
- $str1 : string
- $str2 : string
- $cs : bool = true
-
case sensitive ?
Return values
string —cut()
protected
cut(string $line, int $length) : string
Parameters
- $line : string
- $length : int
Return values
string —feedStringWithParams()
protected
feedStringWithParams(string $line, array<string|int, mixed> $params) : string
Parameters
- $line : string
- $params : array<string|int, mixed>
Return values
string —isUuid()
protected
isUuid(string $uuid) : bool
Parameters
- $uuid : string
Return values
bool —token()
protected
token([int $length = 15 ]) : string
Parameters
- $length : int = 15
Return values
string —uuid()
Generate uuid: 2b5a7a87-8db1-445f-a17b-405790f91c80
protected
uuid(int $length) : string
Parameters
- $length : int
Return values
string —configureEvent()
private
configureEvent(FederatedEvent $event, IFederatedItem $item) : mixed
Parameters
- $event : FederatedEvent
- $item : IFederatedItem
Return values
mixed —confirmRequiredCondition()
Some event might require additional check
private
confirmRequiredCondition(FederatedEvent $event, IFederatedItem $item[, bool $checkLocalOnly = true ]) : mixed
Parameters
- $event : FederatedEvent
- $item : IFederatedItem
- $checkLocalOnly : bool = true
Tags
Return values
mixed —confirmSharedItem()
private
confirmSharedItem(FederatedEvent $event, IFederatedItem $item) : void
Parameters
- $event : FederatedEvent
- $item : IFederatedItem
Tags
Return values
void —generationClientOptions()
private
generationClientOptions(NCRequest $request) : mixed
Parameters
- $request : NCRequest
Return values
mixed —getChosenEncryption()
private
getChosenEncryption(NCSignatory $signatory) : string
Parameters
- $signatory : NCSignatory
Return values
string —getUsedEncryption()
private
getUsedEncryption(NCSignedRequest $signedRequest) : string
Parameters
- $signedRequest : NCSignedRequest
Return values
string —parseIncomingSignatureHeader()
private
parseIncomingSignatureHeader(NCSignedRequest $signedRequest) : void
Parameters
- $signedRequest : NCSignedRequest
Tags
Return values
void —setFederatedEventBypass()
Some event might need to bypass some checks
private
setFederatedEventBypass(FederatedEvent $event, IFederatedItem $item) : mixed
Parameters
- $event : FederatedEvent
- $item : IFederatedItem
Return values
mixed —setIncomingClearSignature()
private
setIncomingClearSignature(NCSignedRequest $signedRequest) : void
Parameters
- $signedRequest : NCSignedRequest
Tags
Return values
void —setIncomingSignatureHeader()
private
setIncomingSignatureHeader(NCSignedRequest $signedRequest) : void
Parameters
- $signedRequest : NCSignedRequest
Return values
void —setOutgoingClearSignature()
private
setOutgoingClearSignature(NCSignedRequest $signedRequest) : void
Parameters
- $signedRequest : NCSignedRequest
Return values
void —setOutgoingSignatureHeader()
private
setOutgoingSignatureHeader(NCSignedRequest $signedRequest) : void
Parameters
- $signedRequest : NCSignedRequest
Return values
void —setOutgoingSignedSignature()
private
setOutgoingSignedSignature(NCSignedRequest $signedRequest) : void
Parameters
- $signedRequest : NCSignedRequest
Tags
Return values
void —signingOutgoingRequest()
private
signingOutgoingRequest(NCSignedRequest $signedRequest) : void
Parameters
- $signedRequest : NCSignedRequest
Return values
void —useClient()
private
useClient(NCRequest $request) : IResponse
Parameters
- $request : NCRequest
Tags
Return values
IResponse —verifyIncomingRequestContent()
private
verifyIncomingRequestContent(NCSignedRequest $signedRequest) : void
Parameters
- $signedRequest : NCSignedRequest
Tags
Return values
void —verifyIncomingRequestSignature()
private
verifyIncomingRequestSignature(NCSignedRequest $signedRequest) : mixed
Parameters
- $signedRequest : NCSignedRequest
Tags
Return values
mixed —verifyIncomingRequestTime()
private
verifyIncomingRequestTime(NCSignedRequest $signedRequest) : void
Parameters
- $signedRequest : NCSignedRequest
Tags
Return values
void —verifySignedRequest()
private
verifySignedRequest(NCSignedRequest $signedRequest) : mixed
Parameters
- $signedRequest : NCSignedRequest