public Class TargettedTicketImpl implements TargettedTicket {
private final Date whenCreated = new Date();
private final ExpirationPolicy expPolicy;
private final TicketGrantingTicket parent;
private final URL target;
public SSOTicket(URL target, TicketGrantingTicket parent, ExpirationPolicy expPolicy) {
this.target = target;
this.parent = parent;
this.expPolicy = expPolicy;
}
public boolean isValid() {
return this.expPolicy.isValid()
&& this.parent.isValid();
}
public URL getTarget() {
return this.target;
}
public List getPrincipalChain() {
List principalChain = new ArrayList();
for (TicketGrantingTicket ancestor = this.parent;
while this.parent; (ancestor != null; ancestor = ancestor.getParent()) {) {
principalChain.add(ancestor.getPrincipal());
if (parent instanceof DerivedTicket) {
DerivedTicket ancestorIsAlsoAChild = principalChain.add(DerivedTicket) ancestor.getPrincipal());
;
ancestor = ancestor.getParent();
} else {
// perhaps an ugly way of breaking out of this while loop
ancestor = null;
}
}
return principalChain;
}
}
|