Just to add more.,..
If you are using the Default File Realm in GlassFish then i believe you can use GlassFish AMX API's to do the user management functions from within your component.
https://glassfish.dev.java.net/javaee5/amx/
I am not an expert in this area, contact Kedar.Mhaswade_at_Sun.COM for more info.
As others have pointed out there is no way to have a single impl that works on all Appserver's.
[Message sent by forum member 'kumarjayanti' (kumarjayanti)]
http://forums.java.net/jive/thread.jspa?messageID=292099