Posts

Showing posts from October, 2017

Facebook Login Integration

Image
In the good old days users logged in by using the combination of username and password. Although nowadays some people still prefer the traditional way, a growing number of users want to sign in by using their social media accounts. But  it’s getting rare and even a bit annoying when a service rolls up its own authentication mechanism instead of relying on a OAuth sign-on with our social networks.  Login via social networks means fewer passwords to remember, and stronger guarantees in terms of security because you can check and control the Authorizations of the applications you use. To Integrate Facebook Login in your application First You need to  to create a web application in Facebook. After logging in to  https://developers.facebook.com/  under Apps menu click “Create a New App” Facebook Application Settings We need to specify the application callback url in the FB settings. This will be used by the FB server on authentication to hand back control to our application.

JIT Compiler

Image
The Just-In-Time (JIT) compiler is a component of the Java Runtime Environment that improves the performance of Java applications at run time. Java programs consists of classes, which contain platform neutral bytecode that can be interpreted by a JVM on many different computer architectures. At run time, the JVM loads the class files, determines the semantics of each individual bytecode, and performs the appropriate computation. The additional processor and memory usage during interpretation means that a Java application performs more slowly than a native application. The JIT compiler helps improve the performance of Java programs by compiling bytecode into native machine code at run time.  Nothing in the JVM affects performance more than the compiler, and choosing a compiler is one of the first decisions made when running a Java application whether you are a Java developer or an end-user. The JIT compiler is enabled by default, and is activated when a Java method is c

JWT to Secure REST API with Spring Boot

Image
JWT Working Flow T o Secure your Rest services and the way to handle users Authentication/Authorization, First Approach is sending basic HTTP auth headers (username/password) for every request, but that would require to keep those credentials in memory and the service would have to check those credentials .So this’s not the best way. This is why REST services typically use a token system. A standard token system returns a 'token' (just a long unique string of random characters, for example a GUID) on successful login. The client in turn then sends this token in every request’s Authorization header. The service, on every request, 'rehydrates' its context by looking up the context on the server side. This context can be stored in a DB, retrieved from a Redis cache or simply stored in memory in a hash table. The downside of this approach is that for every REST method you will need to do this lookup in the database or cache. And then comes JSON Web Tokens, or JWT

Why We create Temporary User Before Actual User

I n secure web application with genuine user, we don't create direct object of User at a time of  user sign up instead of at the time  user sign up on your application we create a temporary User Object in which we store only some fields of user which  are taken at a time of sign up. (Example : name , email Id , password,contact no). We provide option of user verification through email or mobile number. When user verified himself on your application then we create the Object of User and persist in database with all fields and give his all functionality of Users. (Example : check balance , update profile ,update Information and many more). Creating a temp object of user and store in database it gives lots of benefit and these are.   S ecurity :  no unsecured or unverified user exist.   F etching Speed :  many users only sign up on application not used it so unnecessary user data not store in database.   S afety From Attackers  : if any one create a loop of 1000 times an