WoopChain authentication and authorization for JSON-RPC
Authentication identifies a user, and authorization verifies user access to requested JSON-RPC methods. WoopChain verifies users using JSON Web Tokens (JWT).
Woop supports two mutually exclusive authentication methods:
Using JSON-RPC authentication and authorization with MetaMask is not supported.
To prevent interception of authentication credentials and authenticated tokens, make
authenticated requests over HTTPS. We recommend running production deployments behind a network
layer that provides SSL termination. Woop does not provide a HTTPS connection natively.
Username and password authentication
Enable authentication from the command line. Supply the credentials file and send a request to the /login endpoint using the username and password. The /login endpoint creates a JWT for making permitted JSON-RPC requests.
To generate an authentication token, make a request to the /login endpoint with your username and password. Specify the HTTP port or the WS port to generate a token to authenticate over HTTP or WS respectively. HTTP and WS requires a different token.
!!! example
Authentication tokens expire five minutes after generation. If you require access after the token expires, you need to generate a new token.
JWT public key authentication
Enable authentication from the command line and supply the external JWT provider's public key.
RSA with private key length of at least 2048 bits using algorithm RS256, RS384 or RS512.
ECDSA private key, using ES256 (secp256r1 or secp256k1), ES384 or ES512.
Woop default is RS256.
!!! example "Example of key generation using OpenSSL"
!!! critical "Private key security" The private key must be kept secret. Never share private keys publicly or on a Web site, even if advertised as secure.
2. Create the JWT
Create the JWT using a trusted authentication provider or library in your own code.
Each user has a list of permissions strings defining the methods they can access. To give access to:
All API methods, specify ["*:*"].
All API methods in an API group, specify ["<api_group>:*"]. For example, ["eth:*"].
Specific API methods, specify ["<api_group>:<method_name>"]. For example, ["admin:peers"].
With authentication enabled, to explicitly specify a user cannot access any methods, include the user with an empty permissions list ([]). Users with an empty permissions list and users not included in the credentials file cannot access any JSON-RPC methods.
Use an authentication token to make requests
Specify the authentication token as a Bearer token in the JSON-RPC request header.
Postman
In the Authorization tab in the TYPE drop-down list, select Bearer Token and specify the token (generated either externally or by the login request).
Always keep your private keys safe -- ideally using
[harware](https://connect2id.com/products/nimbus-jose-jwt/examples/pkcs11) or
[vault](https://www.vaultproject.io/docs/secrets/identity/identity-token) --
and define a strong security policy and
[best practices](https://auth0.com/docs/best-practices/token-best-practices).
Compromised keys can provide attackers access to you nodes RPC-API.