// IsecureComponent
Map<String, WaspAction> authorized = new HashMap<String, WaspAction>();
authorized.put(SecureComponentHelper.alias(PageA.class), application.getActionFactory()
.getAction("access"));
login(authorized);
new PageA(); // still allowed here
authorized.clear();
authorized.put(SecureComponentHelper.alias(SecureTextField.class),
application.getActionFactory().getAction("access"));
logoff(authorized);
try
{
new PageA();
fail("somehow page was instantiated");
}
catch (UnauthorizedInstantiationException e)
{
// because we are not allowed to instantiate a SecureTextField
// anymore
}
mock.processRequest();
try
{
tearDown();
setSecureClass(ISecurePage.class);
setUp();
}
catch (Exception e)
{
log.error(e.getMessage(), e);
fail(e.getMessage());
}
doLogin();
// now we only check pages so all components will be created, this does
// not affect
// the render check though
logoff(authorized);
authorized.clear();
authorized.put(SecureComponentHelper.alias(PageA.class), application.getActionFactory()
.getAction("access"));
// need to enable page a again
login(authorized);
new PageA(); // only pages are checked so now securetextfield is
// allowed.
mock.processRequest();
}