Security
OpenGate security
This section describes how access to the OpenGate REST APIs is secured. It covers the two supported authentication mechanisms, JWT and API keys, and the user password reset procedure.
This section describes how access to the OpenGate REST APIs is secured. It covers the two supported authentication mechanisms, JWT and API keys, and the user password reset procedure.
The OpenGate REST APIs, and device integration mechanisms are enabled by default on all accounts. You don’t have to do anything to turn on these features. However, JWT (JSON Web Token) and API keys are mandatory and are used to control the access to the resources via the REST APIs and connectors.
The OpenGate REST APIs allow third-party applications or back-office systems to communicate with OpenGate. All users in your organization can use third-party applications to access your entity’s data, such as iPhone apps, Android apps, or network-based communication built onto your server. The OpenGate authentication mechanisms ensure the proper access to the information.
JSON Web Token (JWT) is an open standard RFC 7519 that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. This information can be verified and trusted because it is digitally signed. JWTs can be signed using a secret (with the HMAC algorithm) or a public/private key pair using RSA or ECDSA.
A JWT consists of three strings separated by dots: the header, the payload and the signature as shown in the following text.
| Part Name | Value |
|---|---|
| Header | eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9 |
| Payload | eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ |
| Signature | SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c |
The header typically consists of two parts: the type of the token, which is JWT, and the signing algorithm being used, such as HMAC SHA256 or RSA.
The second part of the token is the payload, which contains the claims. Claims are statements about an entity (typically, the user) and additional data. There are three types of claims: registered, public, and private claims.
To create the signature part you have to take the encoded header, the encoded payload, a secret, the algorithm specified in the header, and sign that.
To obtain a JWT token with OpenGate platform, you should do login with the resource /provision/users/login in the next link JWT.
The JWT (JSON Web Token) can be sent using as a request header.
It is sent using the Authorization HTTP header. An example of POST request may look like this:
This option can be disabled through configuration in all interfaces, with the exception of those used for device integration. The API keys can be sent using one of the following methods:
This is the recommended method of sending your API key. While it is not secure if sent over an unencrypted connection, it is less likely to be logged as part of the URL:
API Key in HTTP header example:
The API key is sent using the X-ApiKey HTTP header. An example of POST request may look like this:
| Parameter Name | Value |
|---|---|
| X-ApiKey | YOUR_API_KEY_HERE |
API key as URL parameter example:
This API provides a secure procedure to change a user’s password when it has been lost or forgotten. The process has two steps: first, request a password reset for the user’s email, which sends a recovery email with a reset identifier; then, set the new password using that reset identifier.
Request a password reset for a user (the platform generates a token and sends a password recovery email):
Set the new password using the reset identifier received by email: