view plugin/icedtea/sun/applet/AppletSecurityContextManager.java @ 1077:86fbcf148d1f

- Implemented JS->Java security. - Removed ambiguity from class finding mechanism for cases where JS needs a signature involving an applet specific class. - Rewrote code that parsed messages from C++ side -- now it can handle any number of optional components.
author Deepak Bhole <dbhole@redhat.com>
date Wed, 08 Oct 2008 17:00:19 -0400
parents 358cb21c4730
children
line wrap: on
line source

package sun.applet;

import java.security.AccessControlContext;
import java.util.HashMap;

public class AppletSecurityContextManager {

	// Context identifier -> PluginAppletSecurityContext object.
	// FIXME: make private
	private static HashMap<Integer, PluginAppletSecurityContext> contexts = new HashMap();
	
	public static void addContext(int identifier, PluginAppletSecurityContext context) {
		contexts.put(identifier, context);
	}
	
	public static PluginAppletSecurityContext getSecurityContext(int identifier) {
		return contexts.get(identifier);
	}

	public static void dumpStore(int identifier) {
		contexts.get(identifier).dumpStore();
	}
	
	public static void handleMessage(int identifier, int reference,	String src, String[] privileges, String message) {
		System.err.println(identifier + " -- " + src + " -- " + reference + " -- " + message + " CONTEXT= " + contexts.get(identifier));
		AccessControlContext callContext = null;

		privileges = privileges != null ? privileges : new String[0];
		callContext = contexts.get(identifier).getAccessControlContext(privileges, src); 

		contexts.get(identifier).handleMessage(reference, src, callContext, message);
	}
}