[cas-dev] Principal.toString

Marvin S. Addison serac at exchange.vt.edu
Thu May 31 09:00:52 EDT 2007


I propose adding a toString method to the Principal interface.  The
value would be in simplifying logging statements:

if (log.isDebugEnabled()) {
	log.debug("Resolved " + principal);
}

As principals grow to include useful attributes (e.g. SimplePrincipal),
it would be enormously helpful to have simple debugging statements as
above print something like:

SimplePrincipal::id=serac,
attributes=mail:{serac at vt.edu,serac at exchange.vt.edu},
groups={staff,cas,admins}

Of course other classes/interfaces could benefit from toString methods,
but Principal is used so often in logging/debugging that requiring
implementers to provide a string representation makes sense.

Thoughts and feedback appreciated.

Marvin
-- 
Application Developer
Middleware Services
Virginia Tech


More information about the cas-dev mailing list