Source Code Cross Referenced for SamlAssertionHeaderBlock.java in  » 6.0-JDK-Modules-com.sun » xws-security » com » sun » xml » wss » core » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules com.sun » xws security » com.sun.xml.wss.core 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: SamlAssertionHeaderBlock.java,v 1.4 2007/01/08 09:28:48 ashutoshshahi Exp $
003:         */
004:
005:        /*
006:         * The contents of this file are subject to the terms
007:         * of the Common Development and Distribution License
008:         * (the License).  You may not use this file except in
009:         * compliance with the License.
010:         * 
011:         * You can obtain a copy of the license at
012:         * https://glassfish.dev.java.net/public/CDDLv1.0.html.
013:         * See the License for the specific language governing
014:         * permissions and limitations under the License.
015:         * 
016:         * When distributing Covered Code, include this CDDL
017:         * Header Notice in each file and include the License file
018:         * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
019:         * If applicable, add the following below the CDDL Header,
020:         * with the fields enclosed by brackets [] replaced by
021:         * you own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         * 
024:         * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
025:         */
026:
027:        package com.sun.xml.wss.core;
028:
029:        import java.util.logging.Logger;
030:        import javax.xml.parsers.ParserConfigurationException;
031:        import javax.xml.soap.SOAPElement;
032:
033:        import org.w3c.dom.Document;
034:        import org.w3c.dom.Element;
035:
036:        import com.sun.xml.wss.impl.misc.SecurityHeaderBlockImpl;
037:        import com.sun.xml.wss.logging.LogDomainConstants;
038:        import com.sun.xml.wss.impl.XMLUtil;
039:        import com.sun.xml.wss.XWSSecurityException;
040:
041:        /**
042:         * The schema definition for a SAML <code>Assertion</code> is as follows:
043:         * <xmp>
044:         * <element name="Assertion" type="saml:AssertionType"/>
045:         * <complexType name="AssertionType">
046:         *     <sequence>
047:         *         <element ref="saml:Conditions" minOccurs="0"/>
048:         *         <element ref="saml:Advice" minOccurs="0"/>
049:         *         <choice maxOccurs="unbounded">
050:         *             <element ref="saml:Statement"/>
051:         *             <element ref="saml:SubjectStatement"/>
052:         *             <element ref="saml:AuthenticationStatement"/>
053:         *             <element ref="saml:AuthorizationDecisionStatement"/>
054:         *             <element ref="saml:AttributeStatement"/>
055:         *         </choice>
056:         *         <element ref="ds:Signature" minOccurs="0"/>
057:         *     </sequence>
058:         *     <attribute name="MajorVersion" type="integer" use="required"/>
059:         *     <attribute name="MinorVersion" type="integer" use="required"/>
060:         *     <attribute name="AssertionID" type="saml:IDType" use="required"/>
061:         *     <attribute name="Issuer" type="string" use="required"/>
062:         *     <attribute name="IssueInstant" type="dateTime" use="required"/>
063:         * </complexType>
064:         * </xmp>
065:         *
066:         * @author Axl Mattheus
067:         */
068:        public class SamlAssertionHeaderBlock extends SecurityHeaderBlockImpl
069:                implements  SecurityToken {
070:            private static Logger log = Logger.getLogger(
071:                    LogDomainConstants.WSS_API_DOMAIN,
072:                    LogDomainConstants.WSS_API_DOMAIN_BUNDLE);
073:
074:            /**
075:             *
076:             * @param element
077:             * @return
078:             * @throws XWSSecurityException
079:             */
080:            public static SecurityHeaderBlock fromSoapElement(
081:                    SOAPElement element) throws XWSSecurityException {
082:                return SecurityHeaderBlockImpl.fromSoapElement(element,
083:                        SamlAssertionHeaderBlock.class);
084:            }
085:
086:            private Document contextDocument_ = null;
087:            private Element delegateAssertion_ = null;
088:
089:            /**
090:             * Constructs code>SamlAssertionHeaderBlock</code> from an existing SAML
091:             * <code>Assertion</code>.
092:             *
093:             * @param assertion
094:             * @throws XWSSecurityException
095:             */
096:            public SamlAssertionHeaderBlock(Element assertion, Document doc)
097:                    throws XWSSecurityException {
098:                if (null != assertion) {
099:                    delegateAssertion_ = assertion;
100:                    contextDocument_ = doc;
101:                } else {
102:                    throw new XWSSecurityException("Assertion may not be null.");
103:                }
104:            }
105:
106:            /**
107:             * Constructs a SAML <code>Assertion</code> header block from an existing
108:             * <code>SOAPElement</code>.
109:             *
110:             * @param element an existing SAML assertion element.
111:             * @throws XWSSecurityException when the element is not a valid template
112:             *         for a SAML <code>Assertion</code>.
113:             */
114:            public SamlAssertionHeaderBlock(SOAPElement element)
115:                    throws XWSSecurityException {
116:                contextDocument_ = element.getOwnerDocument();
117:
118:                delegateAssertion_ = element;
119:
120:                setSOAPElement(element);
121:            }
122:
123:            /* (non-Javadoc)
124:             * @see com.sun.xml.wss.SecurityHeaderBlock#getAsSoapElement()
125:             */
126:            public SOAPElement getAsSoapElement() throws XWSSecurityException {
127:
128:                // uncomment after making SamlAssertionHeaderBlock like others (using a dirty flag).
129:                if (delegateElement != null) {
130:                    return delegateElement;
131:                }
132:
133:                if (null == contextDocument_) {
134:                    try {
135:                        contextDocument_ = XMLUtil.newDocument();
136:                    } catch (ParserConfigurationException e) {
137:                        throw new XWSSecurityException(e);
138:                    }
139:                }
140:
141:                try {
142:                    SOAPElement se = (SOAPElement) contextDocument_.importNode(
143:                            delegateAssertion_, true);
144:                    setSOAPElement(se);
145:
146:                } catch (Exception e) {
147:                    throw new XWSSecurityException(e);
148:                }
149:
150:                return super .getAsSoapElement();
151:            }
152:
153:            /**
154:             * @return
155:             */
156:            public Document getContextDocument() {
157:                return contextDocument_;
158:            }
159:
160:            /**
161:             * @return
162:             */
163:            public Element getDelegateAssertion() {
164:                return delegateAssertion_;
165:            }
166:
167:            /**
168:             * Set the signature for the Request.
169:             *
170:             * @param elem <code>ds:Signature</code> element.
171:             * @return A boolean value: true if the operation succeeds; false otherwise.
172:             */
173:            /*public boolean setSignature(Element elem) {
174:                try {
175:                    JAXBContext jc =
176:                        JAXBContext.newInstance("com.sun.xml.wss.saml.internal");
177:                    javax.xml.bind.Unmarshaller u = jc.createUnmarshaller();
178:                    delegateAssertion_.setSignature((SignatureType)u.unmarshal(elem));
179:                    return true;
180:                } catch ( Exception ex) {
181:                    return false;
182:                }
183:            }*/
184:
185:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.