Friday, April 5, 2013

JBOSS Login module tutorial



STEP 1
Jsp login form

  • set form action as j_security_check
  • set user ID text field name as j_username
  • set password text field name as j_password
login.jsp


STEP 2
Set security area of the web application in web.xml file
Hear we are defined separate secured url patten such as http://www.localhost/test-login/secure/home.jsp  .

This mean request which comes with url patten like http://www.localhost/test-login/secure/* only could access for successfully log-in users.


/WEB-INF/web.xml

In the login-config.xml it should be mention
  • login-relam name
  • login form url
  • login error url

STEP 3
Add jboss-web.xml in WEB-INF folder in project

/WEB-INF/jboss-web.xml

STEP 4
JBOSS Configuration

Add new application policy on log-config.xml. Hear
  • TESTLoginRealm – login-relam name
  • test_datasource – Datasource name which has created on test_ds.xml in deploy directory
  • principalsQuery – This query should return password of the user
/default/conf/login-config.xml


Add multiple log for JBOSS server


  1. $JBOSS_HOME\<jboss instance eg: default>\conf\jboss-log4j.xml
  2. Add new appender
  3. Add new category with reference to appender

Hear priority value should be  DEBUG , INFO, WARN, ERROR,FATAL
if you put,

  1. DEBUG you will have all logging levels
  2. INFO you will INFO, WARN, ERROR,FATAL
  3. WARN you will  WARN, ERROR,FATAL
  4. ERROR you will   ERROR,FATAL
Put package name which contain you logger java class as  category name
Eg : com.dinusha

Spring context file path from outside jar

How to add plug-in to eclipse manually

  1. Download  and extract Eclipse  zip or tar file
  2. go to eclipse home folder(\opt\eclipse or F:\eclipse)
  3. There you can fined folder call features and plugins. Copy that extracted eclipse plugin folder into both features and plugins