01: /*
02: * $Id: SubjectLocality.java,v 1.3 2007/01/08 16:06:00 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.SubjectLocalityType;
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: The <code>SubjectLocality</code> element specifies the DNS domain name
40: and IP address for the system entity that performed the authentication.
41: It exists as part of <code>AuthenticationStatement</code> element.
42: */
43: public class SubjectLocality extends SubjectLocalityType implements
44: com.sun.xml.wss.saml.SubjectLocality {
45:
46: protected static final Logger log = Logger.getLogger(
47: LogDomainConstants.WSS_API_DOMAIN,
48: LogDomainConstants.WSS_API_DOMAIN_BUNDLE);
49:
50: /**
51: Constructor
52: Constructor taking in nothing (assertion schema 25 allows it )
53: */
54: public SubjectLocality() {
55: super ();
56: }
57:
58: /**
59: * Constructs an instance of <code>SubjectLocality</code> from an existing
60: * XML block.
61: *
62: * @param localityElement A <code>org.w3c.dom.Element</code> representing
63: * DOM tree for <code>SubjectLocality</code> object.
64: * @exception SAMLException if it could not process the Element properly,
65: * implying that there is an error in the sender or in the
66: * element definition.
67: */
68: public static SubjectLocalityType fromElement(
69: org.w3c.dom.Element element) throws SAMLException {
70: try {
71: JAXBContext jc = SAML20JAXBUtil.getJAXBContext();
72:
73: javax.xml.bind.Unmarshaller u = jc.createUnmarshaller();
74: return (SubjectLocalityType) u.unmarshal(element);
75: } catch (Exception ex) {
76: throw new SAMLException(ex.getMessage());
77: }
78: }
79:
80: /**
81: * Constructs an instance of <code>SubjectLocality</code>.
82: *
83: * @param ipAddress String representing the IP Address of the entity
84: * that was authenticated.
85: * @param dnsAddress String representing the DNS Address of the entity that
86: * was authenticated. As per SAML specification they are both
87: * optional, so values can be null.
88: */
89: public SubjectLocality(String address, String dnsName) {
90: setAddress(address);
91: setDNSName(dnsName);
92: }
93: }
|