/** Test that a bean cannot access the SecurityAssociation class
*/
public void testSecurityAssociation() throws Exception
{
log.debug("+++ testSecurityAssociation()");
BadBean bean = getBadSession();
try
{
bean.getPrincipal();
doFail("Was able to call Bad.getPrincipal");
}
catch(Exception e)
{
log.debug("Bad.getPrincipal failed as expected", e);
}
try
{
bean.getCredential();
doFail("Was able to call Bad.getCredential");
}
catch(Exception e)
{
log.debug("Bad.getCredential failed as expected", e);
}
try
{
bean.setPrincipal(null);
doFail("Was able to call Bad.setPrincipal");
}
catch(Exception e)
{
log.debug("Bad.setPrincipal failed as expected", e);
}
try
{
char[] password = "secret".toCharArray();
bean.setCredential(password);
doFail("Was able to call Bad.setCredential");
}
catch(Exception e)
{
log.debug("Bad.setCredential failed as expected", e);