Step 1) Write your custom module - there are enough examples out there - I used (http://x-techteam.blogspot.com/2008/03/glassfish-login-module-simple-example.html)
Step 2) Add to login.conf [glassfish location]\glassfish\domains\[domain name]\config
yourRealm{
za.co.jaas.realm.YourLoginModule required;
};
Step 3) Admin console setup
Tick Default Principal To Role Mapping in configurations\[Your config]\Security\ and save
stop glassfish
REDEPLOY APPLICATION
start glasfish
NOTE : When writing a startup script please remeber to start db before start of Assfish otherwise you will have some strange funky errors.
Step 2) Add to login.conf [glassfish location]\glassfish\domains\[domain name]\config
yourRealm{
za.co.jaas.realm.YourLoginModule required;
};
Step 3) Admin console setup
- Goto admin console : http://localhost:4848 and Login
- Goto Cconfigurations\[Your config]\Security\Realms
- Click new button
- ClassName: za.co.jaas.realm.YourRealm (choose second custom radio button)
- Name: yourRealm
- Press the ok button
Tick Default Principal To Role Mapping in configurations\[Your config]\Security\ and save
stop glassfish
REDEPLOY APPLICATION
start glasfish
NOTE : When writing a startup script please remeber to start db before start of Assfish otherwise you will have some strange funky errors.
I recommend to package and deploy the CustomRealm as an OSGi module. See http://stackoverflow.com/questions/4526674/custom-glassfish-security-realm-does-not-work-unable-to-find-loginmodule for details.
ReplyDeleteSpot on, Thanks will make it so
ReplyDelete