01: /*
02: * $Id: OneTimeUse.java,v 1.3 2007/01/08 16:05:59 shyam_rao Exp $
03: */
04:
05: /*
06: * The contents of this file are subject to the terms
07: * of the Common Development and Distribution License
08: * (the License). You may not use this file except in
09: * compliance with the License.
10: *
11: * You can obtain a copy of the license at
12: * https://glassfish.dev.java.net/public/CDDLv1.0.html.
13: * See the License for the specific language governing
14: * permissions and limitations under the License.
15: *
16: * When distributing Covered Code, include this CDDL
17: * Header Notice in each file and include the License file
18: * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
19: * If applicable, add the following below the CDDL Header,
20: * with the fields enclosed by brackets [] replaced by
21: * you own identifying information:
22: * "Portions Copyrighted [year] [name of copyright owner]"
23: *
24: * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
25: */
26:
27: package com.sun.xml.wss.saml.assertion.saml20.jaxb20;
28:
29: import com.sun.xml.wss.saml.SAMLException;
30:
31: import com.sun.xml.wss.logging.LogDomainConstants;
32: import com.sun.xml.wss.saml.internal.saml20.jaxb20.OneTimeUseType;
33: import com.sun.xml.wss.saml.util.SAML20JAXBUtil;
34: import java.util.logging.Logger;
35:
36: import javax.xml.bind.JAXBContext;
37:
38: /**
39: *This is an implementation of the abstract <code>Condition</code> class, which
40: * specifes that the assertion this <code>OneTimeUse</code> is part of,
41: * is the new element in SAML 1.1, that allows an assertion party to express that
42: * an assertion should not be cached by the relying party for future use. In another
43: * word, such an assertion is meant only for "one-time" use by the relying party.
44: */
45: public class OneTimeUse extends OneTimeUseType implements
46: com.sun.xml.wss.saml.OneTimeUse {
47:
48: protected static final Logger log = Logger.getLogger(
49: LogDomainConstants.WSS_API_DOMAIN,
50: LogDomainConstants.WSS_API_DOMAIN_BUNDLE);
51:
52: /**
53: * Constructs a <code>OneTimeUse</code> element from
54: * an existing XML block.
55: *
56: * @param OneTimeUseElement A
57: * <code>org.w3c.dom.Element</code> representing DOM tree
58: * for <code>OneTimeUse</code> object.
59: * @exception SAMLException if it could not process the
60: * <code>org.w3c.dom.Element</code> properly, implying that
61: * there is an error in the sender or in the element definition.
62: */
63: public static OneTimeUseType fromElement(org.w3c.dom.Element element)
64: throws SAMLException {
65: try {
66: JAXBContext jc = SAML20JAXBUtil.getJAXBContext();
67:
68: javax.xml.bind.Unmarshaller u = jc.createUnmarshaller();
69: return (OneTimeUseType) u.unmarshal(element);
70: } catch (Exception ex) {
71: throw new SAMLException(ex.getMessage());
72: }
73: }
74: }
|