001/** 002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 003 * 004 * Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved 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://opensso.dev.java.net/public/CDDLv1.0.html or 013 * opensso/legal/CDDLv1.0.txt 014 * See the License for the specific language governing 015 * permission and limitations under the License. 016 * 017 * When distributing Covered Code, include this CDDL 018 * Header Notice in each file and include the License file 019 * at opensso/legal/CDDLv1.0.txt. 020 * If applicable, add the following below the CDDL Header, 021 * with the fields enclosed by brackets [] replaced by 022 * your own identifying information: 023 * "Portions Copyrighted [year] [name of copyright owner]" 024 * 025 * $Id: ProtocolFactory.java,v 1.5 2008/06/25 05:47:57 qcheng Exp $ 026 * 027 */ 028 029package com.sun.identity.saml2.protocol; 030 031import org.w3c.dom.Element; 032 033import com.sun.identity.saml2.common.SAML2Exception; 034import com.sun.identity.saml2.common.SAML2SDKUtils; 035import com.sun.identity.saml2.protocol.impl.ArtifactImpl; 036import com.sun.identity.saml2.protocol.impl.ArtifactResolveImpl; 037import com.sun.identity.saml2.protocol.impl.ArtifactResponseImpl; 038import com.sun.identity.saml2.protocol.impl.AssertionIDRequestImpl; 039import com.sun.identity.saml2.protocol.impl.AttributeQueryImpl; 040import com.sun.identity.saml2.protocol.impl.AuthnQueryImpl; 041import com.sun.identity.saml2.protocol.impl.AuthnRequestImpl; 042import com.sun.identity.saml2.protocol.impl.ExtensionsImpl; 043import com.sun.identity.saml2.protocol.impl.GetCompleteImpl; 044import com.sun.identity.saml2.protocol.impl.IDPEntryImpl; 045import com.sun.identity.saml2.protocol.impl.IDPListImpl; 046import com.sun.identity.saml2.protocol.impl.LogoutRequestImpl; 047import com.sun.identity.saml2.protocol.impl.LogoutResponseImpl; 048import com.sun.identity.saml2.protocol.impl.ManageNameIDRequestImpl; 049import com.sun.identity.saml2.protocol.impl.ManageNameIDResponseImpl; 050import com.sun.identity.saml2.protocol.impl.NameIDMappingRequestImpl; 051import com.sun.identity.saml2.protocol.impl.NameIDMappingResponseImpl; 052import com.sun.identity.saml2.protocol.impl.NameIDPolicyImpl; 053import com.sun.identity.saml2.protocol.impl.NewEncryptedIDImpl; 054import com.sun.identity.saml2.protocol.impl.NewIDImpl; 055import com.sun.identity.saml2.protocol.impl.RequestedAuthnContextImpl; 056import com.sun.identity.saml2.protocol.impl.RequesterIDImpl; 057import com.sun.identity.saml2.protocol.impl.ResponseImpl; 058import com.sun.identity.saml2.protocol.impl.ScopingImpl; 059import com.sun.identity.saml2.protocol.impl.SessionIndexImpl; 060import com.sun.identity.saml2.protocol.impl.StatusMessageImpl; 061import com.sun.identity.saml2.protocol.impl.StatusImpl; 062import com.sun.identity.saml2.protocol.impl.StatusCodeImpl; 063import com.sun.identity.saml2.protocol.impl.StatusDetailImpl; 064 065/** 066 * This is the factory class to obtain object instances for concrete elements in 067 * the protocol schema. This factory class provides 3 methods for each element. 068 * <code>createElementName()</code>, 069 * <code>createElementName(String value)</code>, 070 * <code>createElementName(org.w3c.dom.Element value)</code>. 071 * 072 * @supported.all.api 073 */ 074public class ProtocolFactory { 075 076 private static ProtocolFactory protoInstance = new ProtocolFactory(); 077 078 /* Constructor for ProtocolFactory */ 079 private ProtocolFactory() { 080 } 081 082 /** 083 * Returns an instance of the <code>ProtocolFactory</code> Object. 084 * 085 * @return an instance of the <code>ProtocolFactory</code> object. 086 */ 087 public static ProtocolFactory getInstance() { 088 return protoInstance; 089 } 090 091 /** 092 * Returns the <code>AssertionIDRequest</code> Object. 093 * 094 * @return the <code>AssertionIDRequest</code> object. 095 * @throws SAML2Exception if <code>AssertionIDRequest</code> cannot be 096 * created. 097 */ 098 public AssertionIDRequest createAssertionIDRequest() throws SAML2Exception { 099 Object obj = SAML2SDKUtils.getObjectInstance( 100 SAML2SDKUtils.ASSERTION_ID_REQUEST); 101 if (obj == null) { 102 return new AssertionIDRequestImpl(); 103 } else { 104 return (AssertionIDRequest) obj; 105 } 106 } 107 108 /** 109 * Returns the <code>AssertionIDRequest</code> Object. 110 * 111 * @param value the Document Element of <code>AssertionIDRequest</code> 112 * object. 113 * @return the <code>AssertionIDRequest</code> object. 114 * @throws SAML2Exception if <code>AssertionIDRequest</code> cannot be 115 * created. 116 */ 117 118 public AssertionIDRequest createAssertionIDRequest(Element value) 119 throws SAML2Exception { 120 Object obj = SAML2SDKUtils.getObjectInstance( 121 SAML2SDKUtils.ASSERTION_ID_REQUEST, value); 122 if (obj == null) { 123 return new AssertionIDRequestImpl(value); 124 } else { 125 return (AssertionIDRequest) obj; 126 } 127 } 128 129 /** 130 * Returns the <code>AssertionIDRequest</code> Object. 131 * 132 * @param value <code>AssertionIDRequest</code> XML String. 133 * @return the <code>AssertionIDRequest</code> object. 134 * @throws SAML2Exception if <code>AssertionIDRequest</code> cannot be 135 * created. 136 */ 137 public AssertionIDRequest createAssertionIDRequest(String value) 138 throws SAML2Exception { 139 Object obj = SAML2SDKUtils.getObjectInstance( 140 SAML2SDKUtils.ASSERTION_ID_REQUEST, value); 141 if (obj == null) { 142 return new AssertionIDRequestImpl(value); 143 } else { 144 return (AssertionIDRequest) obj; 145 } 146 } 147 148 /** 149 * Returns the <code>AttributeQuery</code> Object. 150 * 151 * @return the <code>AttributeQuery</code> object. 152 * @throws SAML2Exception if <code>AttributeQuery</code> cannot be created. 153 */ 154 public AttributeQuery createAttributeQuery() throws SAML2Exception { 155 Object obj = SAML2SDKUtils.getObjectInstance( 156 SAML2SDKUtils.ATTRIBUTE_QUERY); 157 if (obj == null) { 158 return new AttributeQueryImpl(); 159 } else { 160 return (AttributeQuery) obj; 161 } 162 } 163 164 /** 165 * Returns the <code>AttributeQuery</code> Object. 166 * 167 * @param value the Document Element of <code>AttributeQuery</code> object. 168 * @return the <code>AttributeQuery</code> object. 169 * @throws SAML2Exception if <code>AttributeQuery</code> cannot be created. 170 */ 171 172 public AttributeQuery createAttributeQuery(Element value) 173 throws SAML2Exception { 174 Object obj = SAML2SDKUtils.getObjectInstance( 175 SAML2SDKUtils.ATTRIBUTE_QUERY, value); 176 if (obj == null) { 177 return new AttributeQueryImpl(value); 178 } else { 179 return (AttributeQuery) obj; 180 } 181 } 182 183 /** 184 * Returns the <code>AttributeQuery</code> Object. 185 * 186 * @param value <code>AttributeQuery</code> XML String. 187 * @return the <code>AttributeQuery</code> object. 188 * @throws SAML2Exception if <code>AttributeQuery</code> cannot be created. 189 */ 190 public AttributeQuery createAttributeQuery(String value) 191 throws SAML2Exception { 192 Object obj = SAML2SDKUtils.getObjectInstance( 193 SAML2SDKUtils.ATTRIBUTE_QUERY, value); 194 if (obj == null) { 195 return new AttributeQueryImpl(value); 196 } else { 197 return (AttributeQuery) obj; 198 } 199 } 200 201 /** 202 * Returns the <code>AuthnQuery</code> Object. 203 * 204 * @return the <code>AuthnQuery</code> object. 205 * @throws SAML2Exception if <code>AuthnQuery</code> cannot be created. 206 */ 207 public AuthnQuery createAuthnQuery() throws SAML2Exception { 208 Object obj = SAML2SDKUtils.getObjectInstance( 209 SAML2SDKUtils.AUTHN_QUERY); 210 if (obj == null) { 211 return new AuthnQueryImpl(); 212 } else { 213 return (AuthnQuery) obj; 214 } 215 } 216 217 /** 218 * Returns the <code>AuthnQuery</code> Object. 219 * 220 * @param value the Document Element of <code>AuthnQuery</code> object. 221 * @return the <code>AuthnQuery</code> object. 222 * @throws SAML2Exception if <code>AuthnQuery</code> cannot be created. 223 */ 224 225 public AuthnQuery createAuthnQuery(Element value) 226 throws SAML2Exception { 227 Object obj = SAML2SDKUtils.getObjectInstance( 228 SAML2SDKUtils.AUTHN_QUERY, value); 229 if (obj == null) { 230 return new AuthnQueryImpl(value); 231 } else { 232 return (AuthnQuery) obj; 233 } 234 } 235 236 /** 237 * Returns the <code>AuthnQuery</code> Object. 238 * 239 * @param value <code>AuthnQuery</code> XML String. 240 * @return the <code>AuthnQuery</code> object. 241 * @throws SAML2Exception if <code>AuthnQuery</code> cannot be created. 242 */ 243 public AuthnQuery createAuthnQuery(String value) 244 throws SAML2Exception { 245 Object obj = SAML2SDKUtils.getObjectInstance( 246 SAML2SDKUtils.AUTHN_QUERY, value); 247 if (obj == null) { 248 return new AuthnQueryImpl(value); 249 } else { 250 return (AuthnQuery) obj; 251 } 252 } 253 254 /** 255 * Returns the <code>AuthnRequest</code> Object. 256 * 257 * @return the <code>AuthnRequest</code> object. 258 * @throws SAML2Exception if <code>AuthnRequest</code> cannot be created. 259 */ 260 public AuthnRequest createAuthnRequest() throws SAML2Exception { 261 Object obj = SAML2SDKUtils.getObjectInstance( 262 SAML2SDKUtils.AUTHN_REQUEST); 263 if (obj == null) { 264 return new AuthnRequestImpl(); 265 } else { 266 return (AuthnRequest) obj; 267 } 268 } 269 270 /** 271 * Returns the <code>AuthnRequest</code> Object. 272 * 273 * @param value the Document Element of <code>AuthnRequest</code> object. 274 * @return the <code>AuthnRequest</code> object. 275 * @throws SAML2Exception if <code>AuthnRequest</code> cannot be created. 276 */ 277 278 public AuthnRequest createAuthnRequest(Element value) throws SAML2Exception { 279 Object obj = SAML2SDKUtils.getObjectInstance( 280 SAML2SDKUtils.AUTHN_REQUEST, value); 281 if (obj == null) { 282 return new AuthnRequestImpl(value); 283 } else { 284 return (AuthnRequest) obj; 285 } 286 } 287 288 /** 289 * Returns the <code>AuthnRequest</code> Object. 290 * 291 * @param value <code>AuthnRequest</code> XML String. 292 * @return the <code>AuthnRequest</code> object. 293 * @throws SAML2Exception if <code>AuthnRequest</code> cannot be created. 294 */ 295 public AuthnRequest createAuthnRequest(String value) throws SAML2Exception { 296 Object obj = SAML2SDKUtils.getObjectInstance( 297 SAML2SDKUtils.AUTHN_REQUEST, value); 298 if (obj == null) { 299 return new AuthnRequestImpl(value); 300 } else { 301 return (AuthnRequest) obj; 302 } 303 } 304 305 /** 306 * Returns the <code>Extensions</code> Object. 307 * 308 * @return the <code>Extensions</code> object. 309 * @throws SAML2Exception if <code>Extensions</code> cannot be created. 310 */ 311 public Extensions createExtensions() throws SAML2Exception { 312 Object obj = SAML2SDKUtils.getObjectInstance( 313 SAML2SDKUtils.EXTENSIONS); 314 if (obj == null) { 315 return new ExtensionsImpl(); 316 } else { 317 return (Extensions) obj; 318 } 319 } 320 321 /** 322 * Returns the <code>Extensions</code> Object. 323 * 324 * @param value the Document Element of <code>Extensions</code> object. 325 * @return instance of <code>Extensions</code> object. 326 * @throws SAML2Exception if <code>Extensions</code> cannot be created. 327 */ 328 329 public Extensions createExtensions(Element value) throws SAML2Exception { 330 Object obj = SAML2SDKUtils.getObjectInstance( 331 SAML2SDKUtils.EXTENSIONS, value); 332 if (obj == null) { 333 return new ExtensionsImpl(value); 334 } else { 335 return (Extensions) obj; 336 } 337 } 338 339 /** 340 * Returns the <code>Extensions</code> Object. 341 * 342 * @param value XML String Representation of <code>Extensions</code> 343 * object. 344 * @return instance of <code>Extensions<code> object. 345 * @throws SAML2Exception if <code>Extensions</code> cannot be created. 346 */ 347 public Extensions createExtensions(String value) throws SAML2Exception { 348 Object obj = SAML2SDKUtils.getObjectInstance( 349 SAML2SDKUtils.EXTENSIONS, value); 350 if (obj == null) { 351 return new ExtensionsImpl(value); 352 } else { 353 return (Extensions) obj; 354 } 355 } 356 357 /** 358 * Returns the <code>GetComplete</code> Object. 359 * 360 * @return instance of <code>GetComplete</code> object. 361 * @throws SAML2Exception if <code>GetComplete</code> cannot be created. 362 */ 363 public GetComplete createGetComplete() throws SAML2Exception { 364 Object obj = SAML2SDKUtils.getObjectInstance( 365 SAML2SDKUtils.GET_COMPLETE); 366 if (obj == null) { 367 return new GetCompleteImpl(); 368 } else { 369 return (GetComplete) obj; 370 } 371 } 372 373 /** 374 * Returns the <code>GetComplete</code> Object. 375 * 376 * @param value Document Element of <code>GetComplete</code> object. 377 * @return instance of <code>GetComplete</code> Object. 378 * @throws SAML2Exception if <code>GetComplete</code> cannot be created. 379 */ 380 381 public GetComplete createGetComplete(Element value) throws SAML2Exception { 382 Object obj = SAML2SDKUtils.getObjectInstance( 383 SAML2SDKUtils.GET_COMPLETE, value); 384 if (obj == null) { 385 return new GetCompleteImpl(value); 386 } else { 387 return (GetComplete) obj; 388 } 389 } 390 391 /** 392 * Returns the <code>GetComplete</code> Object. 393 * 394 * @param value XML String representation of <code>GetComplete</code> 395 * object. 396 * @return instance of <code>GetComplete</code> Object. 397 * @throws SAML2Exception if <code>GetComplete</code> cannot be created. 398 */ 399 public GetComplete createGetComplete(String value) throws SAML2Exception { 400 Object obj = SAML2SDKUtils.getObjectInstance( 401 SAML2SDKUtils.GET_COMPLETE, value); 402 if (obj == null) { 403 return new GetCompleteImpl(value); 404 } else { 405 return (GetComplete) obj; 406 } 407 } 408 409 /** 410 * Returns the <code>IDPEntry</code> Object. 411 * 412 * @return instance of <code>IDPEntry<code> object. 413 * @throws SAML2Exception if <code>IDPEntry<code> cannot be created. 414 */ 415 public IDPEntry createIDPEntry() throws SAML2Exception { 416 Object obj = SAML2SDKUtils.getObjectInstance( 417 SAML2SDKUtils.IDPENTRY); 418 if (obj == null) { 419 return new IDPEntryImpl(); 420 } else { 421 return (IDPEntry) obj; 422 } 423 } 424 425 /** 426 * Returns the <code>IDPEntry</code> Object. 427 * 428 * @param value Document Element of <code>IDPEntry<code> object. 429 * @return instance of <code>IDPEntry<code> object. 430 * @throws SAML2Exception if <code>IDPEntry<code> cannot be created. 431 */ 432 public IDPEntry createIDPEntry(Element value) throws SAML2Exception { 433 Object obj = SAML2SDKUtils.getObjectInstance( 434 SAML2SDKUtils.IDPENTRY, value); 435 if (obj == null) { 436 return new IDPEntryImpl(value); 437 } else { 438 return (IDPEntry) obj; 439 } 440 } 441 442 /** 443 * Returns the <code>IDPEntry</code> Object. 444 * 445 * @param value XML Representation of the <code>IDPEntry<code> object. 446 * @return instance of <code>IDPEntry<code> Object. 447 * @throws SAML2Exception if <code>IDPEntry<code> cannot be created. 448 */ 449 public IDPEntry createIDPEntry(String value) throws SAML2Exception { 450 Object obj = SAML2SDKUtils.getObjectInstance( 451 SAML2SDKUtils.IDPENTRY, value); 452 if (obj == null) { 453 return new IDPEntryImpl(value); 454 } else { 455 return (IDPEntry) obj; 456 } 457 } 458 459 /** 460 * Returns the <code>IDPList</code> Object. 461 * 462 * @return instance of <code>IDPList<code> Object. 463 * @throws SAML2Exception if <code>IDPList<code> cannot be created. 464 */ 465 public IDPList createIDPList() throws SAML2Exception { 466 Object obj = SAML2SDKUtils.getObjectInstance( 467 SAML2SDKUtils.IDPLIST); 468 if (obj == null) { 469 return new IDPListImpl(); 470 } else { 471 return (IDPList) obj; 472 } 473 } 474 475 /** 476 * Returns the <code>IDPList</code> Object. 477 * 478 * @param value Document Element of <code>IDPList</code> Object. 479 * @return instance of <code>IDPList<code> Object. 480 * @throws SAML2Exception if <code>IDPList<code> cannot be created. 481 */ 482 public IDPList createIDPList(Element value) throws SAML2Exception { 483 Object obj = SAML2SDKUtils.getObjectInstance( 484 SAML2SDKUtils.IDPLIST, value); 485 if (obj == null) { 486 return new IDPListImpl(value); 487 } else { 488 return (IDPList) obj; 489 } 490 } 491 492 /** 493 * Returns the <code>IDPList</code> Object. 494 * 495 * @param value XML String Representation of <code>IDPList</code> Object. 496 * @return instance of <code>IDPList</code> Object. 497 * @throws SAML2Exception if <code>IDPList<code> cannot be created. 498 */ 499 public IDPList createIDPList(String value) throws SAML2Exception { 500 Object obj = SAML2SDKUtils.getObjectInstance( 501 SAML2SDKUtils.IDPLIST, value); 502 if (obj == null) { 503 return new IDPListImpl(value); 504 } else { 505 return (IDPList) obj; 506 } 507 } 508 509 /** 510 * Returns the <code>NameIDPolicy</code> Object. 511 * 512 * @return instance of <code>NameIDPolicy</code> Object. 513 * @throws SAML2Exception if <code>NameIDPolicy<code> cannot be created. 514 */ 515 public NameIDPolicy createNameIDPolicy() throws SAML2Exception { 516 Object obj = SAML2SDKUtils.getObjectInstance( 517 SAML2SDKUtils.NAMEID_POLICY); 518 if (obj == null) { 519 return new NameIDPolicyImpl(); 520 } else { 521 return (NameIDPolicy) obj; 522 } 523 } 524 525 /** 526 * Returns the <code>NameIDPolicy</code> Object. 527 * 528 * @param value Document Element of <code>NameIDPolicy</code> Object. 529 * @return instance of <code>NameIDPolicy</code> Object. 530 * @throws SAML2Exception if <code>NameIDPolicy<code> cannot be created. 531 */ 532 public NameIDPolicy createNameIDPolicy(Element value) throws SAML2Exception { 533 Object obj = SAML2SDKUtils.getObjectInstance( 534 SAML2SDKUtils.NAMEID_POLICY, value); 535 if (obj == null) { 536 return new NameIDPolicyImpl(value); 537 } else { 538 return (NameIDPolicy) obj; 539 } 540 } 541 542 /** 543 * Returns the <code>NameIDPolicy</code> Object. 544 * 545 * @param value XML String Representation of <code>NameIDPolicy</code> 546 * object. 547 * @return instance of <code>NameIDPolicy</code> object. 548 * @throws SAML2Exception if <code>NameIDPolicy<code> cannot be created. 549 */ 550 public NameIDPolicy createNameIDPolicy(String value) throws SAML2Exception { 551 Object obj = SAML2SDKUtils.getObjectInstance( 552 SAML2SDKUtils.NAMEID_POLICY, value); 553 if (obj == null) { 554 return new NameIDPolicyImpl(value); 555 } else { 556 return (NameIDPolicy) obj; 557 } 558 } 559 560 /** 561 * Returns the <code>RequesterID</code> Object. 562 * 563 * @return instance of <code>RequesterID</code> Object. 564 * @throws SAML2Exception if <code>RequesterID<code> cannot be created. 565 */ 566 public RequesterID createRequesterID() throws SAML2Exception { 567 Object obj = SAML2SDKUtils.getObjectInstance( 568 SAML2SDKUtils.REQUESTERID); 569 if (obj == null) { 570 return new RequesterIDImpl(); 571 } else { 572 return (RequesterID) obj; 573 } 574 } 575 576 /** 577 * Returns the <code>RequesterID</code> Object. 578 * 579 * @param value Document Element of <code>RequesterID</code> Object. 580 * @return instance of <code>RequesterID</code> Object. 581 * @throws SAML2Exception if <code>RequesterID<code> cannot be created. 582 */ 583 public RequesterID createRequesterID(Element value) throws SAML2Exception { 584 Object obj = SAML2SDKUtils.getObjectInstance( 585 SAML2SDKUtils.REQUESTERID, value); 586 if (obj == null) { 587 return new RequesterIDImpl(value); 588 } else { 589 return (RequesterID) obj; 590 } 591 } 592 593 /** 594 * Returns the <code>RequesterID</code> Object. 595 * 596 * @param value XML String Representation of <code>RequesterID</code> 597 * object. 598 * @return instance of <code>RequesterID</code> Object. 599 * @throws SAML2Exception if <code>RequesterID<code> cannot be created. 600 */ 601 public RequesterID createRequesterID(String value) throws SAML2Exception { 602 Object obj = SAML2SDKUtils.getObjectInstance( 603 SAML2SDKUtils.REQUESTERID, value); 604 if (obj == null) { 605 return new RequesterIDImpl(value); 606 } else { 607 return (RequesterID) obj; 608 } 609 } 610 611 /** 612 * Returns the <code>Scoping</code> Object. 613 * 614 * @return instance of <code>Scoping</code> Object. 615 * @throws SAML2Exception if <code>Scoping<code> cannot be created. 616 */ 617 public Scoping createScoping() throws SAML2Exception { 618 Object obj = SAML2SDKUtils.getObjectInstance( 619 SAML2SDKUtils.SCOPING); 620 if (obj == null) { 621 return new ScopingImpl(); 622 } else { 623 return (Scoping) obj; 624 } 625 } 626 627 /** 628 * Returns the <code>Scoping</code> Object. 629 * 630 * @param value Document Element of <code>Scoping</code> Object. 631 * @return instance of <code>Scoping</code> Object. 632 * @throws SAML2Exception if <code>Scoping<code> cannot be created. 633 */ 634 public Scoping createScoping(Element value) throws SAML2Exception { 635 Object obj = SAML2SDKUtils.getObjectInstance( 636 SAML2SDKUtils.SCOPING, value); 637 if (obj == null) { 638 return new ScopingImpl(value); 639 } else { 640 return (Scoping) obj; 641 } 642 } 643 644 /** 645 * Returns the <code>Scoping</code> Object. 646 * 647 * @param value XML String Representation of <code>Scoping</code> Object. 648 * @return instance of <code>Scoping</code> Object. 649 * @throws SAML2Exception if <code>Scoping<code> cannot be created. 650 */ 651 public Scoping createScoping(String value) throws SAML2Exception { 652 Object obj = SAML2SDKUtils.getObjectInstance( 653 SAML2SDKUtils.SCOPING, value); 654 if (obj == null) { 655 return new ScopingImpl(value); 656 } else { 657 return (Scoping) obj; 658 } 659 } 660 661 /** 662 * Returns a mutable requested authentication context object. 663 * 664 * @throws SAML2Exception if it failed to instantiate the object. 665 * @return the <code>RequestedAuthnContext</code> object. 666 */ 667 public RequestedAuthnContext createRequestedAuthnContext() 668 throws SAML2Exception { 669 Object obj = SAML2SDKUtils.getObjectInstance( 670 SAML2SDKUtils.REQUESTED_AUTHN_CONTEXT); 671 if (obj == null) { 672 return new RequestedAuthnContextImpl(); 673 } else { 674 return (RequestedAuthnContext) obj; 675 } 676 } 677 678 /** 679 * Returns an immutable requested authentication context object. 680 * 681 * @param value DOM element representing requested authentication 682 * context object. 683 * @throws SAML2Exception if it failed to instantiate the object. 684 * @return an immutable requested authentication context object. 685 */ 686 public RequestedAuthnContext createRequestedAuthnContext(Element value) 687 throws SAML2Exception { 688 Object obj = SAML2SDKUtils.getObjectInstance( 689 SAML2SDKUtils.REQUESTED_AUTHN_CONTEXT, value); 690 if (obj == null) { 691 return new RequestedAuthnContextImpl(value); 692 } else { 693 return (RequestedAuthnContext) obj; 694 } 695 } 696 697 /** 698 * Returns an immutable requested authentication context object. 699 * 700 * @param value XML string representing requested authentication 701 * context object. 702 * @throws SAML2Exception if it failed to instantiate the object. 703 * @return an immutable requested authentication context object. 704 */ 705 public RequestedAuthnContext createRequestedAuthnContext(String value) 706 throws SAML2Exception { 707 Object obj = SAML2SDKUtils.getObjectInstance( 708 SAML2SDKUtils.REQUESTED_AUTHN_CONTEXT, value); 709 if (obj == null) { 710 return new RequestedAuthnContextImpl(value); 711 } else { 712 return (RequestedAuthnContext) obj; 713 } 714 } 715 716 /** 717 * Returns a mutable manage name identifier request object. 718 * 719 * @return the <code>ManageNameIDRequest</code> object. 720 */ 721 public ManageNameIDRequest createManageNameIDRequest() { 722 Object obj = SAML2SDKUtils.getObjectInstance( 723 SAML2SDKUtils.MANAGE_NAMEID_REQUEST); 724 if (obj == null) { 725 return new ManageNameIDRequestImpl(); 726 } else { 727 return (ManageNameIDRequest) obj; 728 } 729 } 730 731 /** 732 * Returns an immutable manage name identifier request object. 733 * 734 * @param value DOM element representing <code>ManageNameIDRequest</code> 735 * object. 736 * @throws SAML2Exception if it failed to instantiate the object. 737 * @return an immutable requested authentication context object. 738 */ 739 public ManageNameIDRequest createManageNameIDRequest(Element value) 740 throws SAML2Exception { 741 Object obj = SAML2SDKUtils.getObjectInstance( 742 SAML2SDKUtils.MANAGE_NAMEID_REQUEST, value); 743 if (obj == null) { 744 return new ManageNameIDRequestImpl(value); 745 } else { 746 return (ManageNameIDRequest) obj; 747 } 748 } 749 750 /** 751 * Returns an immutable manage name identifier request object. 752 * 753 * @param value XML string representing <code>ManageNameIDRequest</code> 754 * object. 755 * @throws SAML2Exception if it failed to instantiate the object. 756 * @return an immutable requested authentication context object. 757 */ 758 public ManageNameIDRequest createManageNameIDRequest(String value) 759 throws SAML2Exception { 760 Object obj = SAML2SDKUtils.getObjectInstance( 761 SAML2SDKUtils.MANAGE_NAMEID_REQUEST, value); 762 if (obj == null) { 763 return new ManageNameIDRequestImpl(value); 764 } else { 765 return (ManageNameIDRequest) obj; 766 } 767 } 768 769 /** 770 * Returns a mutable manage name identifier response object. 771 * 772 * @return the <code>ManageNameIDResponse</code> object. 773 */ 774 public ManageNameIDResponse createManageNameIDResponse() { 775 Object obj = SAML2SDKUtils.getObjectInstance( 776 SAML2SDKUtils.MANAGE_NAMEID_RESPONSE); 777 if (obj == null) { 778 return new ManageNameIDResponseImpl(); 779 } else { 780 return (ManageNameIDResponse) obj; 781 } 782 } 783 784 /** 785 * Returns an immutable manage name identifier response object. 786 * 787 * @param value DOM element representing <code>ManageNameIDResponse</code> 788 * object. 789 * @throws SAML2Exception if it failed to instantiate the object. 790 * @return an immutable requested authentication context object. 791 */ 792 public ManageNameIDResponse createManageNameIDResponse(Element value) 793 throws SAML2Exception { 794 Object obj = SAML2SDKUtils.getObjectInstance( 795 SAML2SDKUtils.MANAGE_NAMEID_RESPONSE, value); 796 if (obj == null) { 797 return new ManageNameIDResponseImpl(value); 798 } else { 799 return (ManageNameIDResponse) obj; 800 } 801 } 802 803 /** 804 * Returns an immutable manage name identifier response object. 805 * 806 * @param value XML String representing <code>ManageNameIDResponse</code> 807 * object. 808 * @throws SAML2Exception if it failed to instantiate the object. 809 * @return an immutable requested authentication context object. 810 */ 811 public ManageNameIDResponse createManageNameIDResponse(String value) 812 throws SAML2Exception { 813 Object obj = SAML2SDKUtils.getObjectInstance( 814 SAML2SDKUtils.MANAGE_NAMEID_RESPONSE, value); 815 if (obj == null) { 816 return new ManageNameIDResponseImpl(value); 817 } else { 818 return (ManageNameIDResponse) obj; 819 } 820 } 821 822 /** 823 * Returns an new identifier object. 824 * 825 * @param value DOM element representing <code>NewID</code> 826 * object. 827 * @throws SAML2Exception if it failed to instantiate the object. 828 * @return an immutable requested authentication context object. 829 */ 830 public NewID createNewID(Element value) 831 throws SAML2Exception { 832 Object obj = SAML2SDKUtils.getObjectInstance( 833 SAML2SDKUtils.NEWID, value); 834 if (obj == null) { 835 return new NewIDImpl(value); 836 } else { 837 return (NewID) obj; 838 } 839 } 840 841 /** 842 * Returns an new identifier object. 843 * 844 * @param value of the <code>NewID<code>. 845 * @throws SAML2Exception if it failed to instantiate the object. 846 * @return an immutable requested authentication context object. 847 */ 848 public NewID createNewID(String value) 849 throws SAML2Exception { 850 Object obj = SAML2SDKUtils.getObjectInstance( 851 SAML2SDKUtils.NEWID, value); 852 if (obj == null) { 853 return new NewIDImpl(value); 854 } else { 855 return (NewID) obj; 856 } 857 } 858 859 /** 860 * Returns an immutable new encrypted identifier object. 861 * 862 * @param value DOM element representing <code>NewEncryptedID</code> 863 * object. 864 * @throws SAML2Exception if it failed to instantiate the object. 865 * @return an immutable requested authentication context object. 866 */ 867 public NewEncryptedID createNewEncryptedID(Element value) 868 throws SAML2Exception { 869 Object obj = SAML2SDKUtils.getObjectInstance( 870 SAML2SDKUtils.NEW_ENCRYPTEDID, value); 871 if (obj == null) { 872 return new NewEncryptedIDImpl(value); 873 } else { 874 return (NewEncryptedID) obj; 875 } 876 } 877 878 /** 879 * Returns an immutable new encrypted identifier object. 880 * 881 * @param value XML String representing <code>NewEncryptedID</code> 882 * object. 883 * @return an immutable requested authentication context object. 884 * @throws SAML2Exception if it failed to instantiate the object. 885 */ 886 public NewEncryptedID createNewEncryptedID(String value) 887 throws SAML2Exception { 888 Object obj = SAML2SDKUtils.getObjectInstance( 889 SAML2SDKUtils.NEW_ENCRYPTEDID, value); 890 if (obj == null) { 891 return new NewEncryptedIDImpl(value); 892 } else { 893 return (NewEncryptedID) obj; 894 } 895 } 896 897 /** 898 * Returns the <code>LogoutRequest</code> Object. 899 * 900 * @return the <code>LogoutRequest</code> object. 901 */ 902 public LogoutRequest createLogoutRequest() { 903 Object obj = SAML2SDKUtils.getObjectInstance( 904 SAML2SDKUtils.LOGOUT_REQUEST); 905 if (obj == null) { 906 return new LogoutRequestImpl(); 907 } else { 908 return (LogoutRequest) obj; 909 } 910 } 911 912 /** 913 * Returns the <code>LogoutRequest</code> Object. This object will be 914 * immutable. 915 * 916 * @param value the <code>org.w3c.dom.Element</code> object representing the 917 * <code>LogoutRequest</code> object. 918 * @return the <code>LogoutRequest</code> object. 919 * @throws SAML2Exception if it fails to instantiate the object. 920 */ 921 public LogoutRequest createLogoutRequest(org.w3c.dom.Element value) 922 throws SAML2Exception { 923 Object obj = SAML2SDKUtils.getObjectInstance( 924 SAML2SDKUtils.LOGOUT_REQUEST, value); 925 if (obj == null) { 926 return new LogoutRequestImpl(value); 927 } else { 928 return (LogoutRequest) obj; 929 } 930 } 931 932 /** 933 * Returns the <code>LogoutRequest</code> Object. This object will be 934 * immutable. 935 * 936 * @param value the <code>String</code> representing the 937 * <code>LogoutRequest</code> object. 938 * @return the <code>LogoutRequest</code> object. 939 * @throws SAML2Exception if it fails to instantiate the object. 940 */ 941 public LogoutRequest createLogoutRequest(String value) 942 throws SAML2Exception { 943 Object obj = SAML2SDKUtils.getObjectInstance( 944 SAML2SDKUtils.LOGOUT_REQUEST, value); 945 if (obj == null) { 946 return new LogoutRequestImpl(value); 947 } else { 948 return (LogoutRequest) obj; 949 } 950 } 951 952 /** 953 * Returns the <code>LogoutResponse</code> Object. 954 * 955 * @return the <code>LogoutResponse</code> object. 956 */ 957 public LogoutResponse createLogoutResponse() { 958 Object obj = SAML2SDKUtils.getObjectInstance( 959 SAML2SDKUtils.LOGOUT_RESPONSE); 960 if (obj == null) { 961 return new LogoutResponseImpl(); 962 } else { 963 return (LogoutResponse) obj; 964 } 965 } 966 967 /** 968 * Returns the <code>LogoutResponse</code> Object. This object will be 969 * immutable. 970 * 971 * @param value the <code>org.w3c.dom.Element</code> representing the 972 * <code>LogoutResponse</code> object. 973 * @return the <code>LogoutResponse</code> object. 974 * @throws SAML2Exception if it fails to instantiate the object. 975 */ 976 public LogoutResponse createLogoutResponse(org.w3c.dom.Element value) 977 throws SAML2Exception { 978 Object obj = SAML2SDKUtils.getObjectInstance( 979 SAML2SDKUtils.LOGOUT_RESPONSE, value); 980 if (obj == null) { 981 return new LogoutResponseImpl(value); 982 } else { 983 return (LogoutResponse) obj; 984 } 985 } 986 987 /** 988 * Returns the <code>LogoutResponse</code> Object. This object will be 989 * immutable. 990 * 991 * @param value the <code>String</code> representing the 992 * <code>LogoutResponse</code> object. 993 * @return the <code>LogoutResponse</code> object. 994 * @throws SAML2Exception if it fails to instantiate the object. 995 */ 996 public LogoutResponse createLogoutResponse(String value) 997 throws SAML2Exception { 998 Object obj = SAML2SDKUtils.getObjectInstance( 999 SAML2SDKUtils.LOGOUT_RESPONSE, value); 1000 if (obj == null) { 1001 return new LogoutResponseImpl(value); 1002 } else { 1003 return (LogoutResponse) obj; 1004 } 1005 } 1006 1007 /** 1008 * Returns the <code>Status</code> Object. 1009 * 1010 * @return the <code>Status</code> object. 1011 * @throws SAML2Exception if it fails to instantiate the object. 1012 */ 1013 public Status createStatus() throws SAML2Exception { 1014 Object obj = SAML2SDKUtils.getObjectInstance( 1015 SAML2SDKUtils.STATUS); 1016 if (obj == null) { 1017 return new StatusImpl(); 1018 } else { 1019 return (Status) obj; 1020 } 1021 } 1022 1023 /** 1024 * Returns the <code>Status</code> Object. This object will be 1025 * immutable. 1026 * 1027 * @param value the <code>org.w3c.dom.Element</code> representing the 1028 * <code>Status</code> object. 1029 * @return the <code>Status</code> object. 1030 * @throws SAML2Exception if it fails to instantiate the object. 1031 */ 1032 public Status createStatus(org.w3c.dom.Element value) 1033 throws SAML2Exception { 1034 Object obj = SAML2SDKUtils.getObjectInstance( 1035 SAML2SDKUtils.STATUS, value); 1036 if (obj == null) { 1037 return new StatusImpl(value); 1038 } else { 1039 return (Status) obj; 1040 } 1041 } 1042 1043 /** 1044 * Returns the <code>Status</code> Object. This object will be 1045 * immutable. 1046 * 1047 * @param value the <code>String</code> representing the 1048 * <code>Status</code> object. 1049 * @return the <code>Status</code> object. 1050 * @throws SAML2Exception if it fails to instantiate the object. 1051 */ 1052 public Status createStatus(String value) throws SAML2Exception { 1053 Object obj = SAML2SDKUtils.getObjectInstance( 1054 SAML2SDKUtils.STATUS, value); 1055 if (obj == null) { 1056 return new StatusImpl(value); 1057 } else { 1058 return (Status) obj; 1059 } 1060 } 1061 1062 /** 1063 * Returns the <code>StatusCode</code> Object. 1064 * 1065 * @return the <code>StatusCode</code> object. 1066 * @throws SAML2Exception if it fails to instantiate the object. 1067 */ 1068 public StatusCode createStatusCode() throws SAML2Exception { 1069 Object obj = SAML2SDKUtils.getObjectInstance( 1070 SAML2SDKUtils.STATUS_CODE); 1071 if (obj == null) { 1072 return new StatusCodeImpl(); 1073 } else { 1074 return (StatusCode) obj; 1075 } 1076 } 1077 1078 /** 1079 * Returns the <code>StatusCode</code> Object. This object will be 1080 * immutable. 1081 * 1082 * @param value the <code>org.w3c.dom.Element</code> representing the 1083 * <code>StatusCode</code> object. 1084 * @return the <code>StatusCode</code> object. 1085 * @throws SAML2Exception if it fails to instantiate the object. 1086 */ 1087 public StatusCode createStatusCode(org.w3c.dom.Element value) 1088 throws SAML2Exception { 1089 Object obj = SAML2SDKUtils.getObjectInstance( 1090 SAML2SDKUtils.STATUS_CODE, value); 1091 if (obj == null) { 1092 return new StatusCodeImpl(value); 1093 } else { 1094 return (StatusCode) obj; 1095 } 1096 } 1097 1098 /** 1099 * Returns the <code>StatusCode</code> Object. This object will be 1100 * immutable. 1101 * 1102 * @param value the <code>String</code> representing the 1103 * <code>StatusCode</code> object. 1104 * @return the <code>StatusCode</code> object. 1105 * @throws SAML2Exception if it fails to instantiate the object. 1106 */ 1107 public StatusCode createStatusCode(String value) throws SAML2Exception { 1108 Object obj = SAML2SDKUtils.getObjectInstance( 1109 SAML2SDKUtils.STATUS_CODE, value); 1110 if (obj == null) { 1111 return new StatusCodeImpl(value); 1112 } else { 1113 return (StatusCode) obj; 1114 } 1115 } 1116 1117 /** 1118 * Returns the <code>StatusDetail</code> Object. 1119 * 1120 * @return the <code>StatusDetail</code> object. 1121 * @throws SAML2Exception if it fails to instantiate the object. 1122 */ 1123 public StatusDetail createStatusDetail() throws SAML2Exception { 1124 Object obj = SAML2SDKUtils.getObjectInstance( 1125 SAML2SDKUtils.STATUS_DETAIL); 1126 if (obj == null) { 1127 return new StatusDetailImpl(); 1128 } else { 1129 return (StatusDetail) obj; 1130 } 1131 } 1132 1133 /** 1134 * Returns the <code>StatusDetail</code> Object. This object will be 1135 * immutable. 1136 * 1137 * @param value the <code>org.w3c.dom.Element</code> representing the 1138 * <code>StatusDetail</code> object. 1139 * @return the <code>StatusDetail</code> object. 1140 * @throws SAML2Exception if it fails to instantiate the object. 1141 */ 1142 public StatusDetail createStatusDetail(org.w3c.dom.Element value) 1143 throws SAML2Exception { 1144 Object obj = SAML2SDKUtils.getObjectInstance( 1145 SAML2SDKUtils.STATUS_DETAIL, value); 1146 if (obj == null) { 1147 return new StatusDetailImpl(value); 1148 } else { 1149 return (StatusDetail) obj; 1150 } 1151 } 1152 1153 /** 1154 * Returns the <code>StatusDetail</code> Object. This object will be 1155 * immutable. 1156 * 1157 * @param value the <code>String</code> representing the 1158 * <code>StatusDetail</code> object. 1159 * @return the <code>StatusDetail</code> object. 1160 * @throws SAML2Exception if it fails to instantiate the object. 1161 */ 1162 public StatusDetail createStatusDetail(String value) 1163 throws SAML2Exception { 1164 Object obj = SAML2SDKUtils.getObjectInstance( 1165 SAML2SDKUtils.STATUS_DETAIL, value); 1166 if (obj == null) { 1167 return new StatusDetailImpl(value); 1168 } else { 1169 return (StatusDetail) obj; 1170 } 1171 } 1172 1173 /** 1174 * Returns the <code>StatusMessage</code> Object. 1175 * 1176 * @param value A String <code>StatusMessage</code> value 1177 * @return the <code>StatusMessage</code> object. 1178 */ 1179 public StatusMessage createStatusMessage(String value) { 1180 Object obj = SAML2SDKUtils.getObjectInstance( 1181 SAML2SDKUtils.STATUS_MESSAGE, value); 1182 if (obj == null) { 1183 return new StatusMessageImpl(value); 1184 } else { 1185 return (StatusMessage) obj; 1186 } 1187 } 1188 1189 /** 1190 * Returns the <code>SessionIndex</code> Object. 1191 * 1192 * @param value A String <code>SessionIndex</code> value 1193 * @return the <code>SessionIndex</code> object. 1194 */ 1195 public SessionIndex createSessionIndex(String value) { 1196 Object obj = SAML2SDKUtils.getObjectInstance( 1197 SAML2SDKUtils.SESSION_INDEX, value); 1198 if (obj == null) { 1199 return new SessionIndexImpl(value); 1200 } else { 1201 return (SessionIndex) obj; 1202 } 1203 } 1204 1205 /** 1206 * Returns a new instance of <code>Artifact</code>. 1207 * 1208 * @param typecode two byte sequence representing <code>TypeCode</code>. 1209 * @param endpointIndex integer value representing 1210 * <code>EndpointIndex</code>. 1211 * @param sourceID String format of 20-byte sequence. Usually obtained 1212 * from taking the SHA-1 hash of the identification URL (called 1213 * provider ID). 1214 * @param messageHandle String format of 20-byte sequence identifying 1215 * a message. This value is constructed from a cryptographically 1216 * strong random or pseudorandom number sequence. 1217 * @return a new instance of <code>Artifact</code>. 1218 * @throws SAML2Exception if it fails to instantiate the object. 1219 */ 1220 public Artifact createArtifact(byte[] typecode, 1221 int endpointIndex, 1222 String sourceID, 1223 String messageHandle) 1224 throws SAML2Exception { 1225 Object obj = SAML2SDKUtils.getObjectInstance(SAML2SDKUtils.ARTIFACT, 1226 typecode, endpointIndex, sourceID, messageHandle); 1227 if (obj == null) { 1228 return new ArtifactImpl(typecode, endpointIndex, 1229 sourceID, messageHandle); 1230 } else { 1231 return (Artifact) obj; 1232 } 1233 } 1234 1235 /** 1236 * Returns a new instance of <code>Artifact</code>. 1237 * The return object is immutable. 1238 * 1239 * @param elem an <code>Element</code> representation of 1240 * <code>Artifact</code>. 1241 * @return a new instance of <code>Artifact</code>. 1242 * @throws SAML2Exception if error occurs while processing the 1243 * <code>Element</code>. 1244 */ 1245 public Artifact createArtifact(org.w3c.dom.Element elem) 1246 throws SAML2Exception { 1247 Object obj = SAML2SDKUtils.getObjectInstance(SAML2SDKUtils.ARTIFACT, 1248 elem); 1249 if (obj == null) { 1250 return new ArtifactImpl(elem); 1251 } else { 1252 return (Artifact) obj; 1253 } 1254 } 1255 1256 /** 1257 * Returns a new instance of <code>Artifact</code>. 1258 * The return object is immutable. 1259 * 1260 * @param encodedArtifactValue <code>Artifact Base64</code> encoded String. 1261 * @return a new instance of <code>Artifact</code>. 1262 * @throws SAML2Exception if error occurs while processing the XML string. 1263 */ 1264 public Artifact createArtifact(String encodedArtifactValue) 1265 throws SAML2Exception { 1266 Object obj = SAML2SDKUtils.getObjectInstance(SAML2SDKUtils.ARTIFACT, 1267 encodedArtifactValue); 1268 if (obj == null) { 1269 return new ArtifactImpl(encodedArtifactValue); 1270 } else { 1271 return (Artifact) obj; 1272 } 1273 } 1274 1275 /** 1276 * Returns a new instance of <code>ArtifactResolve</code>. 1277 * Caller may need to call setters of the class to populate the object. 1278 * 1279 * @return a new instance of <code>ArtifactResolve</code>. 1280 */ 1281 public ArtifactResolve createArtifactResolve() { 1282 Object obj = SAML2SDKUtils.getObjectInstance( 1283 SAML2SDKUtils.ARTIFACT_RESOLVE); 1284 if (obj == null) { 1285 return new ArtifactResolveImpl(); 1286 } else { 1287 return (ArtifactResolve) obj; 1288 } 1289 } 1290 1291 /** 1292 * Returns a new instance of <code>ArtifactResolve</code>. 1293 * The return object is immutable. 1294 * 1295 * @param elem an <code>Element</code> representation of 1296 * <code>ArtifactResolve</code>. 1297 * @return a new instance of <code>ArtifactResolve</code>. 1298 * @throws SAML2Exception if error occurs 1299 * while processing the <code>Element</code>. 1300 */ 1301 public ArtifactResolve createArtifactResolve(org.w3c.dom.Element elem) 1302 throws SAML2Exception { 1303 Object obj = SAML2SDKUtils.getObjectInstance( 1304 SAML2SDKUtils.ARTIFACT_RESOLVE, elem); 1305 if (obj == null) { 1306 return new ArtifactResolveImpl(elem); 1307 } else { 1308 return (ArtifactResolve) obj; 1309 } 1310 } 1311 1312 /** 1313 * Returns a new instance of <code>ArtifactResolve</code>. 1314 * The return object is immutable. 1315 * 1316 * @param xml a XML String representation of <code>ArtifactResolve</code>. 1317 * @return a new instance of <code>ArtifactResolve</code>. 1318 * @throws SAML2Exception if error occurs while processing the XML string. 1319 */ 1320 public ArtifactResolve createArtifactResolve(String xml) 1321 throws SAML2Exception { 1322 Object obj = SAML2SDKUtils.getObjectInstance( 1323 SAML2SDKUtils.ARTIFACT_RESOLVE, xml); 1324 if (obj == null) { 1325 return new ArtifactResolveImpl(xml); 1326 } else { 1327 return (ArtifactResolve) obj; 1328 } 1329 } 1330 1331 /** 1332 * Returns a new instance of <code>ArtifactResponse</code>. 1333 * Caller may need to call setters of the class to populate the object. 1334 * 1335 * @return a new instance of <code>ArtifactResponse</code>. 1336 */ 1337 public ArtifactResponse createArtifactResponse() { 1338 Object obj = SAML2SDKUtils.getObjectInstance( 1339 SAML2SDKUtils.ARTIFACT_RESPONSE); 1340 if (obj == null) { 1341 return new ArtifactResponseImpl(); 1342 } else { 1343 return (ArtifactResponse) obj; 1344 } 1345 } 1346 1347 /** 1348 * Returns a new instance of <code>ArtifactResponse</code>. 1349 * The return object is immutable. 1350 * 1351 * @param elem an <code>Element</code> representing 1352 * <code>ArtifactResponse</code>. 1353 * @return a new instance of <code>ArtifactResponse</code>. 1354 * @throws SAML2Exception if error occurs 1355 * while processing the <code>Element</code>. 1356 */ 1357 public ArtifactResponse createArtifactResponse(org.w3c.dom.Element elem) 1358 throws SAML2Exception { 1359 Object obj = SAML2SDKUtils.getObjectInstance( 1360 SAML2SDKUtils.ARTIFACT_RESPONSE, elem); 1361 if (obj == null) { 1362 return new ArtifactResponseImpl(elem); 1363 } else { 1364 return (ArtifactResponse) obj; 1365 } 1366 } 1367 1368 /** 1369 * Returns a new instance of <code>ArtifactResponse</code>. 1370 * The return object is immutable. 1371 * 1372 * @param xml a XML String representation of <code>ArtifactResponse</code>. 1373 * @return a new instance of <code>ArtifactResponse</code>. 1374 * @throws com.sun.identity.saml2.common.SAML2Exception if error occurs 1375 * while processing the XML string. 1376 */ 1377 public ArtifactResponse createArtifactResponse(String xml) 1378 throws SAML2Exception { 1379 Object obj = SAML2SDKUtils.getObjectInstance( 1380 SAML2SDKUtils.ARTIFACT_RESPONSE, xml); 1381 if (obj == null) { 1382 return new ArtifactResponseImpl(xml); 1383 } else { 1384 return (ArtifactResponse) obj; 1385 } 1386 } 1387 1388 /** 1389 * Returns a new instance of <code>Response</code>. 1390 * Caller may need to call setters of the class to populate the object. 1391 * 1392 * @return a new instance of <code>Response</code>. 1393 */ 1394 public Response createResponse() { 1395 Object obj = SAML2SDKUtils.getObjectInstance( 1396 SAML2SDKUtils.RESPONSE); 1397 if (obj == null) { 1398 return new ResponseImpl(); 1399 } else { 1400 return (Response) obj; 1401 } 1402 } 1403 1404 /** 1405 * Returns a new instance of <code>Response</code>. 1406 * The return object is immutable. 1407 * 1408 * @param elem an <code>Element</code> representation of 1409 * <code>Response</code>. 1410 * @return a new instance of <code>Response</code>. 1411 * @throws SAML2Exception if error occurs 1412 * while processing the <code>Element</code>. 1413 */ 1414 public Response createResponse(org.w3c.dom.Element elem) 1415 throws SAML2Exception { 1416 Object obj = SAML2SDKUtils.getObjectInstance( 1417 SAML2SDKUtils.RESPONSE, elem); 1418 if (obj == null) { 1419 return new ResponseImpl(elem); 1420 } else { 1421 return (Response) obj; 1422 } 1423 } 1424 1425 /** 1426 * Returns a new instance of <code>Response</code>. 1427 * The return object is immutable. 1428 * 1429 * @param xml a XML String representation of <code>Response</code>. 1430 * @return a new instance of <code>Response</code>. 1431 * @throws SAML2Exception if error occurs while processing the XML string. 1432 */ 1433 public Response createResponse(String xml) 1434 throws SAML2Exception { 1435 Object obj = SAML2SDKUtils.getObjectInstance( 1436 SAML2SDKUtils.RESPONSE, xml); 1437 if (obj == null) { 1438 return new ResponseImpl(xml); 1439 } else { 1440 return (Response) obj; 1441 } 1442 } 1443 1444 /** 1445 * Returns the <code>NameIDMappingRequest</code> Object. 1446 * 1447 * @return the <code>NameIDMappingRequest</code> object. 1448 */ 1449 public NameIDMappingRequest createNameIDMappingRequest() { 1450 Object obj = SAML2SDKUtils.getObjectInstance( 1451 SAML2SDKUtils.NAMEIDMAPPING_REQ); 1452 if (obj == null) { 1453 return new NameIDMappingRequestImpl(); 1454 } else { 1455 return (NameIDMappingRequest) obj; 1456 } 1457 } 1458 1459 /** 1460 * Returns the <code>NameIDMappingRequest</code> Object. 1461 * 1462 * @param elem the Document Element of <code>NameIDMappingRequest</code> 1463 * object. 1464 * @return the <code>NameIDMappingRequest</code> object. 1465 * @throws SAML2Exception if <code>NameIDMappingRequest</code> cannot be 1466 * created. 1467 */ 1468 public NameIDMappingRequest createNameIDMappingRequest(Element elem) 1469 throws SAML2Exception { 1470 1471 Object obj = SAML2SDKUtils.getObjectInstance( 1472 SAML2SDKUtils.NAMEIDMAPPING_REQ, elem); 1473 if (obj == null) { 1474 return new NameIDMappingRequestImpl(elem); 1475 } else { 1476 return (NameIDMappingRequest) obj; 1477 } 1478 } 1479 1480 /** 1481 * Returns the <code>NameIDMappingRequest</code> Object. 1482 * 1483 * @param value <code>NameIDMappingRequest</code> XML String. 1484 * @return the <code>NameIDMappingRequest</code> object. 1485 * @throws SAML2Exception if <code>NameIDMappingRequest</code> cannot be 1486 * created. 1487 */ 1488 public NameIDMappingRequest createNameIDMappingRequest(String value) 1489 throws SAML2Exception { 1490 1491 Object obj = SAML2SDKUtils.getObjectInstance( 1492 SAML2SDKUtils.NAMEIDMAPPING_REQ, value); 1493 if (obj == null) { 1494 return new NameIDMappingRequestImpl(value); 1495 } else { 1496 return (NameIDMappingRequest) obj; 1497 } 1498 } 1499 1500 /** 1501 * Returns the <code>NameIDMappingResponse</code> Object. 1502 * 1503 * @return the <code>NameIDMappingResponse</code> object. 1504 */ 1505 public NameIDMappingResponse createNameIDMappingResponse() { 1506 Object obj = SAML2SDKUtils.getObjectInstance( 1507 SAML2SDKUtils.NAMEIDMAPPING_RES); 1508 if (obj == null) { 1509 return new NameIDMappingResponseImpl(); 1510 } else { 1511 return (NameIDMappingResponse) obj; 1512 } 1513 } 1514 1515 /** 1516 * Returns the <code>NameIDMappingResponse</code> Object. 1517 * 1518 * @param elem the Document Element of <code>NameIDMappingResponse</code> 1519 * object. 1520 * @return the <code>NameIDMappingResponse</code> object. 1521 * @throws SAML2Exception if <code>NameIDMappingResponse</code> cannot be 1522 * created. 1523 */ 1524 public NameIDMappingResponse createNameIDMappingResponse(Element elem) 1525 throws SAML2Exception { 1526 1527 Object obj = SAML2SDKUtils.getObjectInstance( 1528 SAML2SDKUtils.NAMEIDMAPPING_RES, elem); 1529 if (obj == null) { 1530 return new NameIDMappingResponseImpl(elem); 1531 } else { 1532 return (NameIDMappingResponse) obj; 1533 } 1534 } 1535 1536 /** 1537 * Returns the <code>NameIDMappingResponse</code> Object. 1538 * 1539 * @param value <code>NameIDMappingResponse</code> XML String. 1540 * @return the <code>NameIDMappingResponse</code> object. 1541 * @throws SAML2Exception if <code>NameIDMappingResponse</code> cannot be 1542 * created. 1543 */ 1544 public NameIDMappingResponse createNameIDMappingResponse(String value) 1545 throws SAML2Exception { 1546 1547 Object obj = SAML2SDKUtils.getObjectInstance( 1548 SAML2SDKUtils.NAMEIDMAPPING_RES, value); 1549 if (obj == null) { 1550 return new NameIDMappingResponseImpl(value); 1551 } else { 1552 return (NameIDMappingResponse) obj; 1553 } 1554 } 1555} 1556