Package org.vrspace.server.api
Class SketchfabController
java.lang.Object
org.vrspace.server.api.ApiBase
org.vrspace.server.api.SketchfabController
@RestController
@RequestMapping("/vrspace/api/sketchfab")
public class SketchfabController
extends ApiBase
You want to download free content from sketchfab, you have to be OAuth2
authorised with them. Once done, the server uses the same credentials for all
further communication with sketchfab, until restart. This is completely
different than Oauth2 used to authenticate with vrspace server, i.e. this is
how vrspace server authenticates with sketchfab. Credentials are kept in
memory only, but the content is cached locally, under content directory
hierarchy, where sketchfab content categories are used for subdirectory name.
Content metadata is stored in the database, as GltfModel entities.
- Author:
- joe
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
static class
static class
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<String>
Sketchfab oauth2 callback, as explained in https://sketchfab.com/developers/oauth#implement-auth-code Uses code provided by client to authorise at sketchfab, and returns 302 redirect to the saved referrer.org.springframework.http.ResponseEntity<GltfModel>
Sketchfab download, as explained in https://sketchfab.com/developers/download-api/downloading-models Requires successful authentication, returns 401 unauthorised unless the server is authorised with sketchfab (token exists).login
(jakarta.servlet.http.HttpServletRequest request) Start of the login sequence.Methods inherited from class org.vrspace.server.api.ApiBase
currentUserName
-
Field Details
-
PATH
- See Also:
-
-
Constructor Details
-
SketchfabController
public SketchfabController()
-
-
Method Details
-
login
@GetMapping("/login") public SketchfabController.LoginResponse login(jakarta.servlet.http.HttpServletRequest request) Start of the login sequence. Returns the sketchfab login url, containing client id and redirect url. Client is then expected to open that url and authorise there. Saves the referrer for later use in callback. -
callback
Sketchfab oauth2 callback, as explained in https://sketchfab.com/developers/oauth#implement-auth-code Uses code provided by client to authorise at sketchfab, and returns 302 redirect to the saved referrer.- Parameters:
code
- provided to the client by sketchfab- Returns:
-
download
@GetMapping("/download") public org.springframework.http.ResponseEntity<GltfModel> download(String uid, jakarta.servlet.http.HttpServletRequest request) Sketchfab download, as explained in https://sketchfab.com/developers/download-api/downloading-models Requires successful authentication, returns 401 unauthorised unless the server is authorised with sketchfab (token exists). In that case, client is expected to attempt to login.- Parameters:
uid
- unique id of the modelrequest
- original request, referrer is saved for later use in case the authentication fails- Returns:
-