token, meaning "token", is a string generated by the server. SuperMap supports SuperMap iServer (hereinafter referred to as: iServer) Use the token with SuperMap iClient3D for WebGL (hereinafter referred to as WebGL client) to specify users who can access the service, and keep the published service confidential.
Usage scenario: Encrypt the service published by iServer so that only some users can access it, which improves the security of the service.
This article describes the method and detailed process of using iServer to encrypt services, WebGL client and iServer using token to access encrypted services, mainly including the following steps:
This article will take the CBD fine model cache as an example to demonstrate the usage process of token.
Use SuperMap iDesktop desktop products to generate S3MB cache of CBD data sets and publish services on SuperMap iServer. For this part, please refer to Load BIM and fine model operation manual.
(1). After publishing the 3D service, enter from the "Service Management" page, find the service, and click "Security", Then click the "small lock" icon on the right side of the service. As shown in Figure 1:
Figure 1: Service security management page
(2). A pop-up window will appear after clicking the icon. By default, anonymous users can be selected for access. Click "Specified users can access", and the following options will appear. Add roles as needed. Click "OK" to set permissions for the service.
Figure 2: Permission setting dialog box
At this time, if you log out of the iServer account and directly access the service through the WebGL client, the browser will report an error.
This step will obtain the token of the service for which the access permission has been set.
(1). In the upper right corner of the service management page, click "Username" at the top of the page, and select "Details":
Figure 2: Token generation 1
(2). Click the user name in the upper right corner of the page and select "Token":
Figure 2: Token generation 2
(3). Then select the client ID type and validity period as needed, and click the "Generate Token" button to obtain the token.
Figure 2: Token generation 3
For services encrypted by iSever token, if the WebGL side calls directly, the scene cannot be loaded and the browser side will report an error:
Figure 2: An error is reported when accessing encrypted services without token
In the corresponding example of the WebGL client, add the token obtained from iServer through the statement in the figure below
Figure 2: Add token to the example
After adding the token, open the web page, the camera flies to the corresponding position, the display effect is as follows:
Figure 2: The effect of normal service access after using token