|
From: <pe...@us...> - 2003-12-19 18:03:37
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/auth
In directory sc8-pr-cvs1:/tmp/cvs-serv5310/src/java/org/neuclear/auth
Modified Files:
AuthenticationTicket.java
Log Message:
Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
- For most cases the main exception to worry about now is InvalidNamedObjectException.
- Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a
runtime exception.
- Source and Store patterns each now have their own exceptions that generalizes the various physical
exceptions that can happen in that area.
Index: AuthenticationTicket.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/auth/AuthenticationTicket.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** AuthenticationTicket.java 21 Nov 2003 13:57:27 -0000 1.6
--- AuthenticationTicket.java 19 Dec 2003 18:03:34 -0000 1.7
***************
*** 12,24 ****
import org.dom4j.Element;
import org.dom4j.Namespace;
import org.neuclear.commons.NeuClearException;
import org.neuclear.commons.time.TimeTools;
! import org.neuclear.id.Identity;
! import org.neuclear.id.NamedObjectReader;
! import org.neuclear.id.SignedNamedObject;
! import org.neuclear.id.SignedNamedCore;
import org.neuclear.xml.xmlsec.XMLSecurityException;
import java.sql.Timestamp;
/**
--- 12,24 ----
import org.dom4j.Element;
import org.dom4j.Namespace;
+ import org.dom4j.QName;
import org.neuclear.commons.NeuClearException;
+ import org.neuclear.commons.Utility;
import org.neuclear.commons.time.TimeTools;
! import org.neuclear.id.*;
import org.neuclear.xml.xmlsec.XMLSecurityException;
import java.sql.Timestamp;
+ import java.text.ParseException;
/**
***************
*** 40,46 ****
* @param validto
* @param siteurl
- * @throws NeuClearException
*/
! private AuthenticationTicket(final SignedNamedCore core, final String requester, final Timestamp validto, final String siteurl) throws NeuClearException {
super(core);
this.validTo = validto.getTime();
--- 40,45 ----
* @param validto
* @param siteurl
*/
! private AuthenticationTicket(final SignedNamedCore core, final String requester, final Timestamp validto, final String siteurl) {
super(core);
this.validTo = validto.getTime();
***************
*** 77,86 ****
* @return
*/
! public final SignedNamedObject read(final SignedNamedCore core, final Element elem) throws NeuClearException, XMLSecurityException {
! final String requester = elem.attributeValue(DocumentHelper.createQName("requester", NS_NSAUTH));
! final String sitehref = elem.attributeValue(DocumentHelper.createQName("sitehref", NS_NSAUTH));
! final Timestamp validto = TimeTools.parseTimeStamp(elem.attributeValue(DocumentHelper.createQName("validto", NS_NSAUTH)));
!
! return new AuthenticationTicket(core, requester, validto, sitehref);
}
--- 76,93 ----
* @return
*/
! public final SignedNamedObject read(final SignedNamedCore core, final Element elem) throws InvalidNamedObjectException {
! final QName qelem=DocumentHelper.createQName(TAG_NAME,NS_NSAUTH);
! InvalidNamedObjectException.assertElementQName(core,elem,qelem);
! final QName qreq = DocumentHelper.createQName("requester", NS_NSAUTH);
! final String requester = InvalidNamedObjectException.assertAttributeQName(core,elem,qreq);
! final QName qsite = DocumentHelper.createQName("sitehref", NS_NSAUTH);
! final String sitehref = InvalidNamedObjectException.assertAttributeQName(core,elem,qsite);
! try {
! final QName qtime = DocumentHelper.createQName("validto", NS_NSAUTH);
! final Timestamp validto = TimeTools.parseTimeStamp(InvalidNamedObjectException.assertAttributeQName(core,elem,qtime));
! return new AuthenticationTicket(core, requester, validto, sitehref);
! } catch (ParseException e) {
! throw new InvalidNamedObjectException(core.getName(),e.getLocalizedMessage());
! }
}
|