@@ -35,3 +35,54 @@ field file0: the file to upload.
3535
3636Download a file from the server.
3737
38+ ### Authentication
39+
40+ The server uses JWT token based authentication. The token is passed in the ` Authorization ` header as a Bearer token.
41+ JWT secret is configured in the ` config.toml ` file.
42+
43+ ``` bash
44+ ./kernelci-storage -generate_jwt_token user@email.com
45+ ```
46+ This will generate a JWT token for the user.
47+
48+ ### Testing upload and download using curl
49+
50+ ``` bash
51+ # Upload
52+ curl -X POST http://files.kernelci.org/upload \
53+ -H " Authorization: Bearer <JWT_TOKEN>" \
54+ -F " path=testfolder" \
55+ -F " file0=@local_folder/local_file"
56+
57+ # File will be uploaded to Azure Blob Storage as testfolder/local_folder/local_file
58+
59+ # Download
60+ curl http://files.kernelci.org/testfolder/local_folder/local_file
61+ ```
62+
63+ ## Principle of operation
64+
65+ sequenceDiagram
66+ participant User
67+ participant Proxy Server
68+ participant Local Cache
69+ participant Azure Blob Storage
70+
71+ %% Upload Flow
72+ User->>Proxy Server: Upload File (POST Request)
73+ Proxy Server->>Azure Blob Storage: Store File in Cloud
74+ Azure Blob Storage-->>Proxy Server: Confirmation
75+ Proxy Server-->>User: Upload Successful
76+
77+ %% Download Flow
78+ User->>Proxy Server: Request File (GET Request)
79+ Proxy Server->>Local Cache: Check if File Exists
80+ alt File Found in Cache
81+ Local Cache-->>Proxy Server: Return Cached File
82+ Proxy Server-->>User: Send File
83+ else File Not in Cache
84+ Proxy Server->>Azure Blob Storage: Fetch File from Cloud
85+ Azure Blob Storage-->>Proxy Server: Send File Data
86+ Proxy Server->>Local Cache: Save File Locally
87+ Proxy Server-->>User: Send File
88+ end
0 commit comments