level operations here.
*/
public Object invoke(Object obj, Method method, Object[] args) throws Throwable
{
Context ctx = new InitialContext();
NameParser parser = ctx.getNameParser("");
String securityDomain = null;
Name name = null;
String methodName = method.getName();
if( methodName.equals("toString") == true )
return SecurityConstants.JAAS_CONTEXT_ROOT + " Context proxy";
if( methodName.equals("list") == true )
return new DomainEnumeration(JNDIBasedSecurityManagement.securityMgrMap.keys(),
JNDIBasedSecurityManagement.securityMgrMap);
if(methodName.equals("bind") || methodName.equals("rebind"))
{
if( args[0] instanceof String )
name = parser.parse((String) args[0]);
else
name = (Name)args[0];
securityDomain = name.get(0);
SecurityDomainContext val = (SecurityDomainContext)args[1];
JNDIBasedSecurityManagement.securityMgrMap.put(securityDomain, val);
return obj;
}
if( methodName.equals("lookup") == false )
throw new OperationNotSupportedException("Only lookup is supported, op="+method);
if( args[0] instanceof String )
name = parser.parse((String) args[0]);
else
name = (Name)args[0];
securityDomain = name.get(0);
SecurityDomainContext securityDomainCtx = lookupSecurityDomain(securityDomain);
//TODO: Legacy expectation was subjectsecuritymgr