001: /*
002: * The contents of this file are subject to the terms
003: * of the Common Development and Distribution License
004: * (the "License"). You may not use this file except
005: * in compliance with the License.
006: *
007: * You can obtain a copy of the license at
008: * https://jwsdp.dev.java.net/CDDLv1.0.html
009: * See the License for the specific language governing
010: * permissions and limitations under the License.
011: *
012: * When distributing Covered Code, include this CDDL
013: * HEADER in each file and include the License file at
014: * https://jwsdp.dev.java.net/CDDLv1.0.html If applicable,
015: * add the following below this CDDL HEADER, with the
016: * fields enclosed by brackets "[]" replaced with your
017: * own identifying information: Portions Copyright [yyyy]
018: * [name of copyright owner]
019: */
020: /*
021: * SAMLAssertion1_1FactoryImpl.java
022: *
023: * Created on August 18, 2005, 12:34 PM
024: *
025: * To change this template, choose Tools | Options and locate the template under
026: * the Source Creation and Management node. Right-click the template and choose
027: * Open. You can then make changes to the template in the Source Editor.
028: */
029:
030: package com.sun.xml.wss.saml.impl;
031:
032: import com.sun.xml.ws.security.opt.crypto.dsig.keyinfo.KeyInfo;
033: import com.sun.xml.wss.XWSSecurityException;
034: import java.util.GregorianCalendar;
035: import java.util.List;
036: import javax.xml.namespace.QName;
037: import org.w3c.dom.Element;
038: import com.sun.xml.wss.saml.*;
039: import com.sun.xml.wss.saml.util.SAMLUtil;
040: import javax.xml.stream.XMLStreamException;
041: import javax.xml.stream.XMLStreamReader;
042:
043: /**
044: *
045: * @author root
046: */
047: public class SAMLAssertion2_1FactoryImpl extends SAMLAssertionFactory {
048:
049: /** Creates a new instance of SAMLAssertion1_1FactoryImpl */
050: public SAMLAssertion2_1FactoryImpl() {
051: }
052:
053: public Action createAction(Element actionElement) {
054: return new com.sun.xml.wss.saml.assertion.saml11.jaxb20.Action(
055: actionElement);
056: }
057:
058: public Action createAction(String action, String namespace) {
059: return new com.sun.xml.wss.saml.assertion.saml11.jaxb20.Action(
060: action, namespace);
061: }
062:
063: public Advice createAdvice(List assertionidreference,
064: List assertion, List otherelement) {
065: return new com.sun.xml.wss.saml.assertion.saml11.jaxb20.Advice(
066: assertionidreference, assertion, otherelement);
067: }
068:
069: public AnyType createAnyType() {
070: return null;
071: }
072:
073: public Assertion createAssertion(org.w3c.dom.Element element)
074: throws SAMLException {
075: return com.sun.xml.wss.saml.assertion.saml11.jaxb20.Assertion
076: .fromElement(element);
077: }
078:
079: public Assertion createAssertion(String assertionID,
080: java.lang.String issuer, GregorianCalendar issueInstant,
081: Conditions conditions, Advice advice, List statements)
082: throws SAMLException {
083:
084: return new com.sun.xml.wss.saml.assertion.saml11.jaxb20.Assertion(
085: assertionID,
086: issuer,
087: issueInstant,
088: (com.sun.xml.wss.saml.assertion.saml11.jaxb20.Conditions) conditions,
089: (com.sun.xml.wss.saml.assertion.saml11.jaxb20.Advice) advice,
090: statements);
091: }
092:
093: public Assertion createAssertion(String ID, NameID issuer,
094: GregorianCalendar issueInstant, Conditions conditions,
095: Advice advice, Subject subject, List statements)
096: throws SAMLException {
097:
098: return null;
099: }
100:
101: public AssertionIDReference createAssertionIDReference() {
102: return null;
103: }
104:
105: public AssertionIDRef createAssertionIDRef() {
106: return null;
107: }
108:
109: public AssertionIDReference createAssertionIDReference(String id) {
110: return null;
111: }
112:
113: public AssertionIDRef createAssertionIDRef(String id) {
114: return null;
115: }
116:
117: public Attribute createAttribute(String name, String nameSpace,
118: List values) {
119: return new com.sun.xml.wss.saml.assertion.saml11.jaxb20.Attribute(
120: name, nameSpace, values);
121: }
122:
123: public Attribute createAttribute(String name, List values) {
124: return null;
125: }
126:
127: public AttributeDesignator createAttributeDesignator(String name,
128: String nameSpace) {
129: return new com.sun.xml.wss.saml.assertion.saml11.jaxb20.AttributeDesignator(
130: name, nameSpace);
131: }
132:
133: public AttributeStatement createAttributeStatement(Subject subj,
134: List attr) {
135: return new com.sun.xml.wss.saml.assertion.saml11.jaxb20.AttributeStatement(
136: (com.sun.xml.wss.saml.assertion.saml11.jaxb20.Subject) subj,
137: attr);
138: }
139:
140: public AttributeStatement createAttributeStatement(List attr) {
141: return null;
142: }
143:
144: public AudienceRestrictionCondition createAudienceRestrictionCondition(
145: List audience) {
146: return new com.sun.xml.wss.saml.assertion.saml11.jaxb20.AudienceRestrictionCondition(
147: audience);
148: }
149:
150: public AudienceRestriction createAudienceRestriction(List audience) {
151: return null;
152: }
153:
154: public AuthenticationStatement createAuthenticationStatement(
155: String authMethod, GregorianCalendar authInstant,
156: Subject subject, SubjectLocality subjectLocality,
157: List authorityBinding) {
158:
159: return new com.sun.xml.wss.saml.assertion.saml11.jaxb20.AuthenticationStatement(
160: authMethod,
161: authInstant,
162: (com.sun.xml.wss.saml.assertion.saml11.jaxb20.Subject) subject,
163: (com.sun.xml.wss.saml.assertion.saml11.jaxb20.SubjectLocality) subjectLocality,
164: authorityBinding);
165: }
166:
167: public AuthnStatement createAuthnStatement(
168: GregorianCalendar authInstant,
169: SubjectLocality subjectLocality, AuthnContext authnContext) {
170:
171: return null;
172: }
173:
174: public AuthorityBinding createAuthorityBinding(QName authKind,
175: String location, String binding) {
176: return new com.sun.xml.wss.saml.assertion.saml11.jaxb20.AuthorityBinding(
177: authKind, location, binding);
178: }
179:
180: public AuthnContext createAuthnContext() {
181: return null;
182: }
183:
184: public AuthorizationDecisionStatement createAuthorizationDecisionStatement(
185: Subject subject, String resource, String decision,
186: List action, Evidence evidence) {
187:
188: return new com.sun.xml.wss.saml.assertion.saml11.jaxb20.AuthorizationDecisionStatement(
189: (com.sun.xml.wss.saml.assertion.saml11.jaxb20.Subject) subject,
190: resource,
191: decision,
192: action,
193: (com.sun.xml.wss.saml.assertion.saml11.jaxb20.Evidence) evidence);
194: }
195:
196: public AuthnDecisionStatement createAuthnDecisionStatement(
197: String resource, String decision, List action,
198: Evidence evidence) {
199:
200: return null;
201: }
202:
203: public Conditions createConditions() {
204: return new com.sun.xml.wss.saml.assertion.saml11.jaxb20.Conditions();
205: }
206:
207: public Conditions createConditions(GregorianCalendar notBefore,
208: GregorianCalendar notOnOrAfter, List condition, List arc,
209: List doNotCacheCnd) {
210:
211: return new com.sun.xml.wss.saml.assertion.saml11.jaxb20.Conditions(
212: notBefore, notOnOrAfter, condition, arc, doNotCacheCnd);
213: }
214:
215: public Conditions createConditions(GregorianCalendar notBefore,
216: GregorianCalendar notOnOrAfter, List condition, List ar,
217: List oneTimeUse, List proxyRestriction) {
218:
219: return null;
220: }
221:
222: public DoNotCacheCondition createDoNotCacheCondition() {
223: return new com.sun.xml.wss.saml.assertion.saml11.jaxb20.DoNotCacheCondition();
224: }
225:
226: public OneTimeUse createOneTimeUse() {
227: return null;
228: }
229:
230: public Evidence createEvidence(List assertionIDRef, List assertion) {
231: return new com.sun.xml.wss.saml.assertion.saml11.jaxb20.Evidence(
232: assertionIDRef, assertion);
233: }
234:
235: public NameIdentifier createNameIdentifier(String name,
236: String nameQualifier, String format) {
237: return new com.sun.xml.wss.saml.assertion.saml11.jaxb20.NameIdentifier(
238: name, nameQualifier, format);
239: }
240:
241: public NameID createNameID(String name, String nameQualifier,
242: String format) {
243: return null;
244: }
245:
246: public Subject createSubject(NameIdentifier nameIdentifier,
247: SubjectConfirmation subjectConfirmation) {
248: return new com.sun.xml.wss.saml.assertion.saml11.jaxb20.Subject(
249: (com.sun.xml.wss.saml.assertion.saml11.jaxb20.NameIdentifier) nameIdentifier,
250: (com.sun.xml.wss.saml.assertion.saml11.jaxb20.SubjectConfirmation) subjectConfirmation);
251: }
252:
253: public Subject createSubject(NameID nameID,
254: SubjectConfirmation subjectConfirmation) {
255: return null;
256: }
257:
258: public SubjectConfirmation createSubjectConfirmation(
259: String confirmationMethod) {
260: return new com.sun.xml.wss.saml.assertion.saml11.jaxb20.SubjectConfirmation(
261: confirmationMethod);
262: }
263:
264: public SubjectConfirmation createSubjectConfirmation(NameID nameID,
265: String method) {
266: return null;
267: }
268:
269: public SubjectConfirmation createSubjectConfirmation(
270: List confirmationMethods, Element subjectConfirmationData,
271: Element keyInfo) throws SAMLException {
272:
273: return new com.sun.xml.wss.saml.assertion.saml11.jaxb20.SubjectConfirmation(
274: confirmationMethods, subjectConfirmationData, keyInfo);
275: }
276:
277: public SubjectConfirmation createSubjectConfirmation(
278: List confirmationMethods, SubjectConfirmationData scd,
279: KeyInfo keyInfo) throws SAMLException {
280: com.sun.xml.wss.saml.assertion.saml11.jaxb20.SubjectConfirmation sc = new com.sun.xml.wss.saml.assertion.saml11.jaxb20.SubjectConfirmation();
281:
282: try {
283: if (keyInfo != null) {
284: sc.setKeyInfo(keyInfo);
285: }
286: if (scd != null) {
287: sc.setSubjectConfirmationData(scd);
288: }
289: } catch (Exception ex) {
290: // log here
291: throw new SAMLException(ex);
292: }
293: sc.setConfirmationMethod(confirmationMethods);
294: return sc;
295: }
296:
297: public SubjectConfirmation createSubjectConfirmation(NameID nameID,
298: SubjectConfirmationData subjectConfirmationData,
299: String confirmationMethod) throws SAMLException {
300:
301: return null;
302: }
303:
304: public SubjectConfirmation createSubjectConfirmation(NameID nameID,
305: KeyInfoConfirmationData subjectConfirmationData,
306: String confirmationMethod) throws SAMLException {
307:
308: return null;
309: }
310:
311: public SubjectConfirmationData createSubjectConfirmationData(
312: String address, String inResponseTo,
313: GregorianCalendar notBefore,
314: GregorianCalendar notOnOrAfter, String recipient,
315: Element keyInfo) throws SAMLException {
316:
317: return null;
318: }
319:
320: public SubjectConfirmationData createSubjectConfirmationData(
321: String address, String inResponseTo,
322: GregorianCalendar notBefore,
323: GregorianCalendar notOnOrAfter, String recipient,
324: KeyInfo keyInfo) throws SAMLException {
325:
326: return null;
327: }
328:
329: public KeyInfoConfirmationData createKeyInfoConfirmationData(
330: Element keyInfo) throws SAMLException {
331:
332: return null;
333: }
334:
335: public SubjectLocality createSubjectLocality() {
336: return new com.sun.xml.wss.saml.assertion.saml11.jaxb20.SubjectLocality();
337: }
338:
339: public SubjectLocality createSubjectLocality(String ipAddress,
340: String dnsAddress) {
341: return new com.sun.xml.wss.saml.assertion.saml11.jaxb20.SubjectLocality(
342: ipAddress, dnsAddress);
343: }
344:
345: public Assertion createAssertion(XMLStreamReader reader)
346: throws SAMLException {
347: try {
348: Element samlElement = SAMLUtil.createSAMLAssertion(reader);
349: Assertion samlAssertion = (Assertion) com.sun.xml.wss.saml.assertion.saml11.jaxb20.Assertion
350: .fromElement(samlElement);
351: return samlAssertion;
352: } catch (XWSSecurityException ex) {
353: throw new SAMLException(ex);
354: } catch (XMLStreamException ex) {
355: throw new SAMLException(ex);
356: }
357: }
358:
359: }
|