Class SketchfabController

  • @RestController
    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.
    • Constructor Detail

      • SketchfabController

        public SketchfabController()
    • Method Detail

      • login

        public SketchfabController.LoginResponse login​(javax.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

        public org.springframework.http.ResponseEntity<String> callback​(String code)
        Sketchfab oauth2 callback, as explained in Uses code provided by client to authorise at sketchfab, and returns 302 redirect to the saved referrer.
        code - provided to the client by sketchfab
      • download

        public org.springframework.http.ResponseEntity<GltfModel> download​(String uid,
                                                                           javax.servlet.http.HttpServletRequest request)
        Sketchfab download, as explained in 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.
        uid - unique id of the model
        request - original request, referrer is saved for later use in case the authentication fails