question on the LoginContext:
Should the LoginContext be initialized in the application code or in the jboss container side?
If u r using container authentication, then JAAS is an internal aspect of JBoss AS.
Now if you want to do authentication in your application and want to do JAAS, then you instantiate the login context. But the configuration of the login module, still happens in conf/login-config.xml or using DynamicLoginConfig.