// Copyright 2000-2005 the Contributors, as shown in the revision logs. // Licensed under the Apache Public Source License 2.0 ("the License"). // You may not use this file except in compliance with the License. package org.ibex.mail; import java.lang.reflect.*; import org.ibex.crypto.*; import org.ibex.util.*; import org.ibex.mail.protocol.*; import org.ibex.io.*; import java.util.*; import java.util.zip.*; import java.net.*; import java.io.*; /** * A convenient way to verify that the agent requesting an action * owns a particular email address. Extend this class; the * Transaction.executeOn() method will be invoked when the user * clicks through. */ public abstract class Confirmation implements Externalizable { public static final long serialVersionUID = 0x981879f18a11ffeeL; public static int master_serial = 0; public transient Address who = null; public long expiration; public abstract String getDescription(); public abstract String getURL(String tail); public int serial; private static HashMap all = new HashMap(); public static Confirmation get(int serial) { return all.get(serial); } protected Confirmation(Address who, long expiration) { this.who = who; this.expiration = expiration; this.serial = master_serial++; all.put(serial, this); } public void readExternal(ObjectInput s) throws IOException { try { int numfields = s.readInt(); Class c = this.getClass(); for(int i=0; i cve.expiration) throw new Expired(); return cve; } catch (IOException e) { Log.error(Confirmation.class, e); throw new InvalidSignature(); } } public static class Exn extends RuntimeException { } public static class Expired extends Exn { } public static class InvalidSignature extends Exn { } }