Events 

This extension comes up with two different categories of PSR-14 Events you can listen to. The first category deals with the generation of token and payload, the second one with the retrieval of assets.

Link Generation 

This event is executed in the Secure Link factory.

Enrich Payload 

You can use this event for extending or manipulating the payload of the JSON Web Token. This event is executed immediately before the JSON Web token is generated. The name of the event is LeuchtfeuerSecureDownloadsFactoryEventEnrichPayloadEvent.

Property
payload
Data Type
array
Description
This array contains the default payload of the JSON Web Token. You can enrich this data by your own properties or manipulate the existing data.
Property
token
Data Type
AbstractToken
Description
This property is read-only and contains the generated token object.

File Retrieving 

These events are executed in the FileDelivery class.

Output Initialization 

This event is executed after the JSON Web Token has been decoded and before the access checks take place. The name of the event is LeuchtfeuerSecureDownloadsResourceEventOutputInitializationEvent.

Property
token
Data Type
AbstractToken
Description
This property contains the decoded token object. You can manipulate the properties. The edited token is then used in the further process.

After File Retrieved 

This event is executed after the access checks has been performed and both the file and the file name have been read from the token. Afterwards, the check is made whether the file is available on the file system. The name of the event is LeuchtfeuerSecureDownloadsResourceEventAfterFileRetrievedEvent.

Property
file
Data Type
string
Description
Contains the absolute path to the file on the file system. You can change this property.
Property
fileName
Data Type
string
Description
Contains the name of the file. You can change this so that another file name is used when downloading this file.

Before Read Deliver 

This event is dispatched once, right after the base header is set up but before the file is delivered. It is the chance to add, amend or override headers sent to the browser (e.g. Content-Type, Content-Disposition) before the response-type-specific defaults for any header not already set here are added. The only exception is Content-Length/Content-Range on a partial (206) response, which always describe the actual byte range read from disk and are not influenced by this event. The name of the event is LeuchtfeuerSecureDownloadsResourceEventBeforeReadDeliverEvent.

Property
header
Data Type
array
Description
An array of header which will be sent to the browser. You can add your own headers or remove default ones.
Property
fileName
Data Type
string
Description
The name of the file. This property is read-only.
Property
mimeType
Data Type
string
Description
The mime type of the file. This property is read-only.
Property
forceDownload
Data Type
boolean
Description
Information whether the file should be forced to download or not. This property is read-only.