securityStorage


URI

<securityManager_uri>/storage[.<format>]

Supported methods

GET, PUT, HEAD

Parent resource

securityManager

Introduction

The securityStorage resource is used to view and set the security information storage location, supporting storing in the MySQL and SQLite database.

Supported Methods:

Supported expressions: RJSON, JSON, HTML (integrated in the securityManager resource page), XML.

Resource hierarchy

HTTP request methods

Implement the HTTP request on the following URI, where supermapiserver is the server name, with rjson being the output format.

http://supermapiserver:8090/iserver/manager/security/storage.rjson

GET request

Get the security information storage configuration in current server.

Response structure

The security information storage configuration returned by the server contains the following fields:

Field Type Description
type SecurityInfoStorageType Security information storage type, supporting: SQLITE, MYSQL, and CUSTOM.
permissionFileURI String 【When the storage type is SQLITE】
Please set the storage file of the service authorization information (*.db), the default is ./WEB-INF/iserver-services.db.
securityFileURI String 【When the storage type is SQLITE】
Please set the storage file of the security information such as users, roles (*.db), the default is ./WEB-INF/iserver-security.db.
connInfo DataSourceConnectionPoolInfo 【When the storage type is MYSQL】
    "connInfo": {
        "jdbcUrl": "jdbc:mysql://192.168.120.42:3306/mysql?useUnicode=true&characterEncoding=UTF-8",
        "username": "myuser1",
        "password": "mypassword",
        "driverClass": "com.mysql.jdbc.Driver",
        "dbType": "MYSQL"
    }

Response example

The implementation of the GET request on the securityStorage resource (http: // localhost: 8090 / iserver / manager / security / session.rjson), returns the security information storage configuration as follows:

{

    "permissionFileURI": "jdbc:sqlite:./WEB-INF/iserver-services.db",

    "securityFileURI": "jdbc:sqlite:./WEB-INF/iserver-security.db",

    "type": "SQLITE"

}

PUT request

Modify the storage configuration of the current server security information, such as storage type, location, and so on.

Request parameter

When modifying the storage configuration of the security information, you need to include the following parameters in the request body:

Field Type Description
type SecurityInfoStorageType Security information storage type, supporting the SQLITE/MYSQL database.
permissionFileURI String 【When the storage type is SQLITE, required】
Please set the storage file of the service authorization information (*.db), the default is ./WEB-INF/iserver-services.db.
securityFileURI String 【When the storage type is SQLITE, required】
Please set the storage file of the security information such as users, roles (*.db), the default is ./WEB-INF/iserver-security.db.
connInfo DataSourceConnectionPoolInfo 【When the storage type is MYSQL, required】
    "connInfo": {
        "jdbcUrl": "jdbc:mysql://192.168.120.42:3306/mysql?useUnicode=true&characterEncoding=UTF-8",
        "username": "myuser1",
        "password": "mypassword",
        "driverClass": "com.mysql.jdbc.Driver",
        "dbType": "MYSQL"
    }

Response structure

After the request is sent, the response structure returned by the server is shown in the following table:

Field Type Description
succeed boolean Whether the operation was successful, true means successful.
error HttpError Operation failure message, which will not be displayed if successful. E.g.:

    "error": {

        "code": 400,

        "errorMsg": "It fails to connect MYSQL database. Possible cause is that the connection information is incorrect or that the specified database is not authorized for remote access"

    }

Response example

Perform PUT request on the securityStorage resource (http://localhost:8090/iserver/manager/security/storage.rjson), the request body in rjson format is as follows:

{

    "connInfo": {

        "jdbcUrl": "jdbc:mysql://myserver:3306/mysql?useUnicode=true&characterEncoding=UTF-8",

        "username": "myuser1",

        "password": "mypassword",

        "driverClass": "com.mysql.jdbc.Driver",

        "dbType": "MYSQL"

    },

    "type": "MYSQL"

}

The response result in rjson format returned is as follows:

{

    "succeed": "True"

}

HEAD request

Returns the same HTTP response header as the GET request, but does not have the response entity. It can get the metadata information in the response header without transferring the whole response content. Metadata information includes media type, character encoding, compression encoding, entity content length, and so on.

The HEAD request can be used to determine whether the securityStorage resource exists or whether the client has authority to access the resource. It can quickly determine whether the securityStorage resource supports the representation in <format> format by performing HEAD request on URI with <format>.

See