Posts

Showing posts from 2013

Spring Security - Adding more information to the authenticated user.

I was using spring Security to perform authentication against the database and I needed to load the user information once the user gets authenticated. However, the spring org.springframework.security.core.userdetails.User object was not allowing me add more details to the logged in User object. In my case, I had to add phone number to the authenticated user. In the following section I'll show as to how to add additional information to the authenticated user. Create an object to contain the additional information. We will first create a MediUser object which will extend the Spring org.springframework.security.core.userdetails.User object. The MediUser object contains additional information like first name, middle name, last name, phone number and alternative phone number. Following is the code for MediUser : import java.util.Collection; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.

Running tomcat maven plugin in Debug mode (in STS, Eclipse and MyEclipse)

Image
Over here I'll explain, as to how to run a tomcat maven plugin in debug mode, in Eclipse and Spring Tool Source (STS). It will be a three step setup and once you are done with the setup, you can run the tomcat server in debug mode with just one click. Following are the setup steps: Step 1 : Entering maven dependency for tomcat in pom.xml file Step 2 : Creating debug configuration Step 3 : Running tomcat server in debug mode Step 1: Entering maven dependency for tomcat in pom.xml file Open your pom.xml file. Enter the tomcat plugin dependency, as shown in the following figure: Now right click on the pom.xml and select Run As à Maven Install . Step 2 :  Creating Debug Configuration Right click on pom.xml and select Debug As à Debug Configurations… A Debug Configurations window will open, as shown in the following figure: On the left hand window right click on Maven Build , as a result, following screen will get displayed:

Dynamic Dialog Boxes

Image
The Basic problem with Dialog Boxes Almost all the web applications use dialog boxes to popup a message to the user or confirm for an action taken by the user. Most of the time we end up using JavaScript for such kind of dialog boxes. And most of the time our purpose gets solved with JavaScript alerts/dialog boxes. However when we have a slightly different request, JavaScript fails to support those requests. For example, client might ask for a Yes/No dialog box instead of Ok/Cancel and JavaScript fails to support this. You can still achieve Yes/No in javascript, however it will have limitations, such as it will work with IE only and it will display VBscript at the title bar of the dialog box. Let’s take another example, where in the client wants to have three buttons on the dialog box. Again javascript fails to support this functionality.  Another example, where in the client wants to have dynamic look and feel , or a look and feel matching the application in context; again ja