Friday, December 9, 2016

Json Web token

A JSON Web Token, or JWT, is used to send information that can be verified and trusted by means of a digital signature. It comprises a compact and URL-safe JSON object, which is cryptographically signed to verify its authenticity, and which can also be encrypted if the payload contains sensitive information.

JWTs can be signed using a secret (with the HMAC algorithm) or a public/private key pair using RSA.

Because of it’s compact structure, JWT is usually used in HTTP Authorizationheaders or URL query parameters.




Thursday, December 1, 2016

NODE - NPM

Node Doc

Installation:
Head to the Node.js download page and grab the version you need. There are Windows and Mac installers available, as well as pre-compiled Linux binaries and source code. For Linux, you can also install Node via the package manager, as is outlined here.
open command prompt ,check version installed
node -v
npm -v

Basic npm command -
npm init => initializes package.json
npm list -g  => list all global npm packages installed
npm list => list all npm packages installed
npm install <package-name> => install package to local
npm install -g <package-name> => install package globally on the system
npm update <package-name> => updates packages name

Wednesday, July 13, 2016

slf4j logging -- log4j / logback

Simple Logging Facade for Java (SLF4J) is an API designed to give generic access to many logging frameworks
- log4j
- logback

To decide log4j or logback depends at the time of deployment ,agnostic to code

ex-

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class HelloWorld
{
    public static void main(String[] args)
    {
        Logger logger = LoggerFactory.getLogger(HelloWorld.class);
        logger.info("Hello World");
    }
}


For above code all you need is slf4j 

  1. SLF4j binding jar file
  2. Desired logging framework jar files (log4j or logback)
There are reasons to use logback ovr log4j because of all the improvments.
Please read below -