After a long time i would like all to gather,
To enlighten the memorable time we spent all together.
To rejoice the past we lived,
Which wont be re-kindled.
To the time which is the most cherished one,
Without any restrictions.
After a long time i would like all to gather......,
When meeting you soon, meant a gap of few hours,
That today turned into a matter of days and their powers.
Once again, let's go back to the same time,
when we played “pakadam pakdai” , in the meal time.
After a long time i would like all to gather......,
To those days when we played truth & dare,
Which was just to spend the time we always had in spare.
To those time when Sadhana Ma'am taught us Hindi,
Which felt like paying for the punishment which we were not guilty.
After a long time i would like all to gather......,
To the time when we have to study Computer,
Of whom Anand Sir was the only tutor.
It was a time when we studied maths by Ranjan Sir,
Who made it a lot easier.
After a long time i would like all to gather......,
To the day when almost everyone failed in Biology,
And later complaining about Renu Ma’am psychology.
It was a time when Digvijay sir taught us Physics,
Who use to dwell himself in "laal chari maidaan khari" lyrics,
After a long time i would like all to gather......,
To the time when Kusum Ma'am taught us English,
Like Julius Caesar, Images of life & figments of imagination seemed rubbish.
To those days when Sabeena Ma'am taught us Chemistry,
Which was like a organic & inorganic hell full of chemical mystery.
After a long time i would like all to gather,
To enlighten the memorable time we spent all together.
Bringing a small tribute to those beautiful time and memory,
All yours Gaurav urf Gandhi.....
Tuesday, December 14, 2010
Friday, December 10, 2010
Journey : Enginering till Joining Date.....
Getting into engineering stream,
Was like a dream.
But getting job while pursuing,
Was like sweet over a full diet meal.
Even though we had troubles,
But my dear friend, just wait for the ball to dribble.
Feel the day will come soon,
When our time will be at boom.
Today after a long break,
i got my placement cake.
So much of waiting is over as of now,
And the time came to say WOW...!
By the time i enjoyed the spark,
i was drowned in another dark.
Its again the waiting of few months,
That will soon come to an end.
Hope the days will past by soon,
Just like sunrise after the dark night without moon.......!
Was like a dream.
But getting job while pursuing,
Was like sweet over a full diet meal.
Even though we had troubles,
But my dear friend, just wait for the ball to dribble.
Feel the day will come soon,
When our time will be at boom.
Today after a long break,
i got my placement cake.
So much of waiting is over as of now,
And the time came to say WOW...!
By the time i enjoyed the spark,
i was drowned in another dark.
Its again the waiting of few months,
That will soon come to an end.
Hope the days will past by soon,
Just like sunrise after the dark night without moon.......!
Thursday, October 7, 2010
Configuring Realm
Hi,
After you have decided the type of connection(jdbc or file) you have to configure your realm as
Creating custom realm -------

2. Left panel Configuration --> Security --> Realm
tht will look like the image SERVERREALM
3. Right Panel Click New
4. Give any name you like just as MyRealm
5. ClassName you can use predefined class or provide your own class name.
6. Provide JAAS_CONTEXT as sampleRealm

/SUNWappserver/domains/domain1/config/login.conf
sampleRealm {
complete path custom login module with required;
};
7. Now place this custom Class file making the proper packaged jar of
loginModule and RealmClass(If Custom Realm).
Put this jar in the /home/gaurav/SUNWappserver/lib
8. Now Restart the server.
Custom Login Module
import com.sun.appserv.security.AppservPasswordLoginModule;
import com.sun.enterprise.security.auth.realm.jdbc.JDBCRealm;
import javax.security.auth.login.LoginException;
/**
* Class SimpleCustomLogin is used for designing our own custom module
* it extends a class provided by GF server that helps us authenticating the user
* Using this we need to take care of single method authenticateUser() that will
* have our logic to confirm about the user.
*/
public class SimpleCustomLoginModule extends AppservPasswordLoginModule {
public SimpleCustomLoginModule() {
//maintaining the log to ensure that our LoginModule is initialized.
log("SimpleCustomLoginModule: Initialization");
}//end of constructor
/**
* this method helps us maintain server log
* so that we can make amendments according to our need
* and it also helps determining the flow.
*/
private void log(String s) {
System.out.println((new StringBuilder())
.append("SimpleCustomLoginModule::").append(s).toString());
}//end of log()
/**
* This is the method we need to overrdide which will have our LOGIC for
* authentication .In this we are using the DATABASE as backend for user.
* So we need to use the JDBCRealm ( Realm - is a set of roles of user
* with their respective users to know more about realm check this out
* http://download.oracle.com/javaee/5/tutorial/doc/
* OR
* http://download-llnw.oracle.com/javaee/6/tutorial/doc/bncas.html).
* Now we need to configure this realm in
* our web.xml under login-config tag from where the server retrieves it.
* Also maintaining evrything in the server log as well.
* We paas authenticated user group(roles here) to commitUserAuthentication
* method for authorization.
*/
@Override
protected void authenticateUser() throws LoginException
{
System.out.println("in authenticate user.....");
//getting the instance of current realm as JDBCRealm
JDBCRealm samplerealm = (JDBCRealm)_currentRealm;
System.out.println("jdbc realm as ....." +samplerealm);
/**
* Checking the instance of the realm whether its taking our JDBC realm
* or not. This will load the user's from database with their name,
* password and roles. Else if not will throw LoginException.
*/
if ( !( _currentRealm instanceof JDBCRealm ) ) {
String msg = sm.getString("filelm.badrealm");
System.out.println("not instance of jdbc realm ....");
throw new LoginException(msg);
}
/**
* Here we get the user's roles from the database in grplist array.
* But here we get only one element in the array.So we need to check.
* Since the value stored in table is in form of varchar(simple strings)
* as roles -- "user,test,......so on"
* Hence we separate it later in groupListToForward.
*/
String[] grpList = samplerealm.authenticate(_username, _password);
System.out.println("username " + _username + "password " + _password);
System.out.println("length from jdbc authenticate ... groups are.." + grpList);
/**
* This id to check whether the user group(role) is null or not.
*/
if ( grpList == null ) { // JAAS behavior
String msg = sm.getString("filelm.faillogin", _username);
throw new LoginException(msg);
}//endif
/**
* make a copy of groupList to pass to LoginModule.
* DO NOT PASS the grpList as is - as it will get overwritten.
* Resulting in logins passing only once.
* In the above grouplist we get only string with multiple user's role.
* grplist value will be like "user,weballow,test"
* But here we split them into multiple roles as roles as
* 1. user 2. weballow 3. test
* That will be passed for proper authorization.
*/
String[] groupListToForward = grpList[0].toString().split(",");
System.out.println("values of group array ..." + groupListToForward.length);
for (int i = 0; i< groupListToForward.length; i++) {
System.out.println("value of groups " + groupListToForward[i].toString());
}
System.out.println("calling commit...");
commitUserAuthentication(groupListToForward);
}//end of authernticateUser()
}//end of SimpleCustomLoginModule
import com.sun.enterprise.security.auth.realm.jdbc.JDBCRealm;
import javax.security.auth.login.LoginException;
/**
* Class SimpleCustomLogin is used for designing our own custom module
* it extends a class provided by GF server that helps us authenticating the user
* Using this we need to take care of single method authenticateUser() that will
* have our logic to confirm about the user.
*/
public class SimpleCustomLoginModule extends AppservPasswordLoginModule {
public SimpleCustomLoginModule() {
//maintaining the log to ensure that our LoginModule is initialized.
log("SimpleCustomLoginModule: Initialization");
}//end of constructor
/**
* this method helps us maintain server log
* so that we can make amendments according to our need
* and it also helps determining the flow.
*/
private void log(String s) {
System.out.println((new StringBuilder())
.append("SimpleCustomLoginModule::").append(s).toString());
}//end of log()
/**
* This is the method we need to overrdide which will have our LOGIC for
* authentication .In this we are using the DATABASE as backend for user.
* So we need to use the JDBCRealm ( Realm - is a set of roles of user
* with their respective users to know more about realm check this out
* http://download.oracle.com/javaee/5/tutorial/doc/
* OR
* http://download-llnw.oracle.com/javaee/6/tutorial/doc/bncas.html).
* Now we need to configure this realm in
* our web.xml under login-config tag from where the server retrieves it.
* Also maintaining evrything in the server log as well.
* We paas authenticated user group(roles here) to commitUserAuthentication
* method for authorization.
*/
@Override
protected void authenticateUser() throws LoginException
{
System.out.println("in authenticate user.....");
//getting the instance of current realm as JDBCRealm
JDBCRealm samplerealm = (JDBCRealm)_currentRealm;
System.out.println("jdbc realm as ....." +samplerealm);
/**
* Checking the instance of the realm whether its taking our JDBC realm
* or not. This will load the user's from database with their name,
* password and roles. Else if not will throw LoginException.
*/
if ( !( _currentRealm instanceof JDBCRealm ) ) {
String msg = sm.getString("filelm.badrealm");
System.out.println("not instance of jdbc realm ....");
throw new LoginException(msg);
}
/**
* Here we get the user's roles from the database in grplist array.
* But here we get only one element in the array.So we need to check.
* Since the value stored in table is in form of varchar(simple strings)
* as roles -- "user,test,......so on"
* Hence we separate it later in groupListToForward.
*/
String[] grpList = samplerealm.authenticate(_username, _password);
System.out.println("username " + _username + "password " + _password);
System.out.println("length from jdbc authenticate ... groups are.." + grpList);
/**
* This id to check whether the user group(role) is null or not.
*/
if ( grpList == null ) { // JAAS behavior
String msg = sm.getString("filelm.faillogin", _username);
throw new LoginException(msg);
}//endif
/**
* make a copy of groupList to pass to LoginModule.
* DO NOT PASS the grpList as is - as it will get overwritten.
* Resulting in logins passing only once.
* In the above grouplist we get only string with multiple user's role.
* grplist value will be like "user,weballow,test"
* But here we split them into multiple roles as roles as
* 1. user 2. weballow 3. test
* That will be passed for proper authorization.
*/
String[] groupListToForward = grpList[0].toString().split(",");
System.out.println("values of group array ..." + groupListToForward.length);
for (int i = 0; i< groupListToForward.length; i++) {
System.out.println("value of groups " + groupListToForward[i].toString());
}
System.out.println("calling commit...");
commitUserAuthentication(groupListToForward);
}//end of authernticateUser()
}//end of SimpleCustomLoginModule
Configuring Database in Glassfish(GF) Server
Hi All,
I have tried making an application implementing JAAS on GlassFish(GF) server for a Web and EJB.

1. Start your GF server.
2. Go to your admin console http://localhost(or IP):4848/
3. In the left panel you will find Resouces --> JDBC --> Connection Pools
4. Now on the right panel create a new databse connection as
6. Give the name you would like to name your databse connection
Name : myDB
Resource Type : javax.sql.DataSource
Databse Vendor : mysql

JNDI Name : jdbc/mySql
Pool Name : myDB
Description : This is my DB connection.
Status : Enabled
8. After creating the connection edit its properites as and you may remove all other properties
datasource-jndi : jdbc/mySql
user-table : usertable
user-name-column : userid
password-name-column : password
group-table : grouptable
group-name-column : groupid
jaas-context : jdbcRealm
digest-algorithm : none
Now to use this connection in your existing application configure your GlassFish(GF) server's realm.
Configuring your own realm. You can check in the same
Regards,
Gaurav Agarwal
Secure Web And EJB - JAAS in Glassfish (GF)
Hi All,
Here are the steps if you wish to create a secure Web and Ejb application using JAAS.
1. If you wish to use your database connection then you need to create a database connection to GlassFish(GF) server. See Configuring Database in GlassFish(GF) Server.
2. After this you need create your realm which has been described in Confuguring Realm
3. Now you need to create your CustomLoginModule.
4. Then lastly you have to set web.xml as in the picture
5. The same role has to mapped in sub-web.xml as
Here are the steps if you wish to create a secure Web and Ejb application using JAAS.
1. If you wish to use your database connection then you need to create a database connection to GlassFish(GF) server. See Configuring Database in GlassFish(GF) Server.

3. Now you need to create your CustomLoginModule.
4. Then lastly you have to set web.xml as in the picture
5. The same role has to mapped in sub-web.xml as
Subscribe to:
Posts (Atom)