Applet using multiple policy files.
1 posts in topic
Flat View  Flat View

Posted By:   Naaman_Campbell
Posted On:   Monday, January 5, 2004 07:35 PM

I attempting to create an applet that retrieves and displays the currently logged in WindowsNT username in the corner of a web page. I would like to use JAAS which requires multiple policy files to be specified at runtime.

How is it possible to include multiple policy files with an applet? I do not wish to use appletviewer -J (that's cheating), I wish this to be used with any applet-compatible browser.


Re: Applet using multiple policy files.

Posted By:   Naaman_Campbell  
Posted On:   Saturday, January 10, 2004 02:57 AM

I have discovered that using
tags inside the
 tags you can pass customised parameters into the applet.


Then inside the applet, you firstly set the final String parameter to be read in.


final String JAAS_PARAM "java.security.auth.login.config";

Also be sure to include the getParameterInfo() method when using custom parameters.


public String[][] getParameterInfo() {
final String[][] PARAMETER_INFO =
{JAAS_PARAM, "The login configuration file URL"},


Finally, the parameter is retrieved from the page that called the applet and is set as a system property.


String value = super.getParameter(JAAS_PARAM);

if (value != null)
System.setProperty(JAAS_PARAM, value);

Source of help:

Dr Dee JAAS Project

HTML Page (try doing a 'View Source')

Applet Code