01: /*
02: * $Id: AuthnContext.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.AuthnContextType;
33: import com.sun.xml.wss.saml.util.SAML20JAXBUtil;
34: import org.w3c.dom.Element;
35: import java.util.logging.Logger;
36:
37: import javax.xml.bind.JAXBContext;
38:
39: /**
40: * The <code>AuthnContext</code> element may be used to indicate
41: * to a replying party receiving an <code>AuthenticationStatement</code> that
42: * a SAML authority may be available to provide additional information about
43: * the subject of the statement. A single SAML authority may advertise its
44: * presence over multiple protocol binding, at multiple locations, and as
45: * more than one kind of authority by sending multiple elements as needed.
46: */
47: public class AuthnContext extends AuthnContextType implements
48: com.sun.xml.wss.saml.AuthnContext {
49:
50: protected static final Logger log = Logger.getLogger(
51: LogDomainConstants.WSS_API_DOMAIN,
52: LogDomainConstants.WSS_API_DOMAIN_BUNDLE);
53:
54: /**
55: * Constructs an <code>AuthnContext</code> element from an existing XML
56: * block.
57: *
58: * @param element representing a DOM tree element.
59: * @exception SAMLException if there is an error in the sender or in the
60: * element definition.
61: */
62: public static AuthnContextType fromElement(Element element)
63: throws SAMLException {
64: try {
65: JAXBContext jc = SAML20JAXBUtil.getJAXBContext();
66:
67: javax.xml.bind.Unmarshaller u = jc.createUnmarshaller();
68: return (AuthnContextType) u.unmarshal(element);
69: } catch (Exception ex) {
70: throw new SAMLException(ex.getMessage());
71: }
72: }
73:
74: /**
75: *Constructor
76: *@param authKind A integer representing the type of SAML protocol queries
77: * to which the authority described by this element will
78: * respond. If you do NO specify this attribute, pass in
79: * value "-1".
80: *@param location A URI describing how to locate and communicate with the
81: * authority, the exact syntax of which depends on the
82: * protocol binding in use.
83: *@param binding A String representing a URI reference identifying the SAML
84: * protocol binding to use in communicating with the authority.
85: *@exception SAMLException if there is an error in the sender or in the
86: * element definition.
87: */
88: public AuthnContext() {
89: // setAuthorityKind(authKind);
90: // setLocation(location);
91: // setBinding(binding);
92: }
93: }
|