简体   繁体   中英

File upload/ download using REST and JSON Web Token

How does file upload/ download works internally, does it require multiple request and response? I am asking this question because I am using spring security for JSON Web Token ( JWT ) Authentication and if file upload/ download requires multiple request/ response then how am I supposed to send the authentication/ refresh token with the file upload/ download request multiple times.

I am using JWT in Java Swing based desktop application.

You can make a single request for the file, providing your token in a bearer header. After authenticating the request (validating the token and checking any claims) the web server should return the file as a stream and specify some response headers to indicate to the client (your Swing desktop application in this case) how to handle the response.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM