Go language is using special formatting tags for date and time, instead of using yyyy-mm-dd as in most languages, it uses a special date to represent format for date and time, this special date and time is:
JSON Web Token is an open standard that defines a compact and self-contained way for securely transmitting digitally signed information between parties as a JSON object.
Compact: it can be sent through an URL, POST parameter, or inside an HTTP header.
Self-contained: the payload has all the necessary information about the user.
Structure of JWT
JWTs contain three parts separated by a dot(.) and they are:
So the JWT look like this:
Each part is Base64url encoded.
The header usually has two parts:
The type of the token
The hashing algorithm used in signing the token
The image below shows an example of a header
The second part of the JWT. It contain claims, which are information about an entity and other data.
Claims are three types: registered (predefined claims), public (User defined), and private(custom claims used to share information between parties).
The image below present an example of a payload
The information contained in the payload are protected against tampering and modification, but they can be read by anyone because they are encoded not encrypted. So you should not put any secret information in the payload unless you encrypt them.
The signature is the third part of the JWT. it can be created by taking the base64 encoded header, the base64 encoded payload, a secret, the algorithm specified in the header and sign that.
Couchbase Server is an open source NoSQL document based database that is optimized for interactive web applications. It provides programmatic access to Couchbase server through the SDKs of the different programming languages.
It has a query language known as N1QL, which has a structure composed of statements, expressions, and comments.
To install latest version of Couchbase in Ubuntu 16.04 (xenial):
First, download Couchbase server from here. Make sure you choose ubuntu 16.04 as the operating system.
Then reload the local package database.
Install Couchbase Server using the following command:
where ./ is the path to the Couchbase server package and * is the version of the package that you have downloaded.
If dpkg reports any errors about missing dependencies, run the following command to download and install them:
Once installation is complete, Couchbase Server will start automatically.
Getting started with Couchbase
Open this link to access the Couchbase Server Web Console.
After signing in successfully, you will be forwarded to Cluster Dashboard.
Click on Buckets in the left-hand navigation bar to go to the bucket screen. On the bucket screen, click on “Add Bucket” to add a new bucket.
After adding a bucket, go to “Query” screen to create primary index for your bucket. Use the following query:
CREATE PRIMARY INDEX ON `bucket_name` USING GSI;
Replace `bucket_name` with the name that you have given to your bucket. Then Execute.