Home     RSSRSS

Compromised Passwords/Account Verification

August 21, 2018 by kiranbadi1991 | Comments Off on Compromised Passwords/Account Verification | Filed in Development, Security

I browse a internet a lot and have accounts across many sites. Sometimes I forget and tend to reuse my password. My account has been compromised many times.

Today while resetting the password for GitHub, I came across the interesting site which helps users to prevent reuse of compromised passwords and informs the user if his password has been compromised.

As a developer we often need to provide some extra security to our users and this site seems to be best effort by the individual that serves the larger purpose(It exposes information via Rest API).

Hopefully community notices this effort and we secure ourselves by sharing information.

Thank you Troy Hunt.

Technorati Tags: ,,

Façade Pattern

May 1, 2018 by kiranbadi1991 | Comments Off on Façade Pattern | Filed in Others

Façade pattern is used to hide the complexity of the sub system and provide users with the simple and easy to use interface to consume.

Commonly used use cases for Façade are

  • Provide simple and easy to use interface to backend legacy system.
  • Sometimes used to build the public interface for users to consume.
  • To abstract the complexity of the system for simplicity and security
  • Depending on use case, it can also be used to improve performance by reducing frequent call invocation and providing remote client single point of access by grouping related functionality in the subset of classes.

Façade Pattern can be implemented for Pojo, stateful and stateless use cases. However for stateful classes it consumes the server resources and ties up to the client during invocation process. So one needs to careful that client do not take up too much of time for processing else server resources will be consumed. Generally if conversational state needs to be maintained then stateful façade can be used.

Generally complexity of the logic dictates the length and abstraction of the wrapper methods in the façade.

Facades can also be used to create factory methods.

Example of Facade can be.

public class Car {

public void 4CylinderEngine(){

	// Methods the exhibit behavior of 4 Cylinder
	}

public void 6CylinderEngine(){
		// Methods the exhibit behavior of 6 Cylinder
	}

}
 
// Using the facade

new Car.4CyclinderEngine();
new Car.6CyclinderEngine();


Concurrency, Thread Safety and Local Variables

August 12, 2016 by kiranbadi1991 | Comments Off on Concurrency, Thread Safety and Local Variables | Filed in Development, Performance Center, Performance Engineering, Performance Test Tools

One of the most of the common reason for concurrency issues I often see in web application is due to concurrent access of data stored in variables. Generally in servlets , data in variables are often stored as Local variables, Instance Variables, Class Variables , request attributes, session attributes and context attributes.

Below example simplest I can think of for storing data as local variable and accessing it in a thread safe manner

public class MyServlet extends httpServlet {

  // mylocalage is localvariable here for this servlet.

    public void printAge(){
              int mylocalage = 0;
      mylocalageage = mylocalage - 10;
      System.out.println("My age 10 years earlier was: " + mylocalage);
      

    }
}

Its considered that by design that data stored in local variable is thread safe.

Every thread accessing the above servlet will have their own values and they will not interface with each other.

image

Local variables are stored in stack in Java. So data stored in these variables are thread safe.

Tags: , ,