Core Classes Classes and Interfaces

Oracle SAML 9-3 ORACLE_HOME\modules\oracle.osdt_11.1.1\osdt_xmlsec.jar; ORACLE_HOME\modules\oracle.osdt_11.1.1\osdt_saml.jar; ORACLE_HOME\modules\oracle.osdt_11.1.1\osdt_saml2.jar; ORACLE_HOME\modules\org.jaxen_1.1.1.jar;

6. Click OK.

9.2.2.2.2 Setting the CLASSPATH on UNIX On UNIX, set your CLASSPATH environment

variable to include the full path and file name of all the required jar and class files. For example: setenv CLASSPATH CLASSPATH:ORACLE_HOMEmodulesoracle.osdt_11.1.1osdt_core.jar: ORACLE_HOMEmodulesoracle.osdt_11.1.1osdt_cert.jar: ORACLE_HOMEmodulesoracle.osdt_11.1.1osdt_xmlsec.jar: ORACLE_HOMEmodulesoracle.osdt_11.1.1osdt_saml.jar: ORACLE_HOMEmodulesoracle.osdt_11.1.1osdt_saml2.jar: ORACLE_HOMEmodulesorg.jaxen_1.1.1.jar

9.2.3 Classes and Interfaces

This section provides information and code samples for using the classes and interfaces of Oracle SAML 1.01.1. It contains these topics: ■ Core Classes ■ Supporting Classes and Interfaces

9.2.3.1 Core Classes

This section provides a brief overview of the core SAML and SAMLP 1.01.1 classes with some brief code examples. The core classes are: ■ The oracle.security.xmlsec.saml.SAMLInitializer Class ■ The oracle.security.xmlsec.saml.Assertion Class ■ The oracle.security.xmlsec.samlp.Request Class ■ The oracle.security.xmlsec.samlp.Response Class

9.2.3.1.1 The oracle.security.xmlsec.saml.SAMLInitializer Class This class initializes the

Oracle SAML toolkit. By default Oracle SAML is automatically initialized for SAML v1.0. You can also initialize Oracle SAML for a specific version of the SAML specification. When the initialize method is called for a specific version, previously initialized versions will remain initialized. Example 9–1 shows how to initialize the SAML toolkit for SAML v1.0 and SAML v1.1. Example 9–1 Initializing the Oracle SAML Toolkit initializes for SAML v1.1 SAMLInitializer.initialize1, 1; initializes for SAML v1.0, done by default SAMLInitializer.initialize1, 0;

9.2.3.1.2 The oracle.security.xmlsec.saml.Assertion Class This class represents the

Assertion element of the SAML Assertion schema. 9-4 Oracle Fusion Middleware Reference for Oracle Security Developer Tools Example 9–2 shows how to create a new Assertion element and append it to an existing XML document. Example 9–2 Creating an Assertion Element and Appending to an XML Document Document doc = Instance of org.w3c.dom.Document; Assertion assertion = new Assertiondoc; doc.getDocumentElement.appendChildassertion; Example 9–3 shows how to obtain Assertion elements from an XML document. Example 9–3 Obtaining Assertion Elements From an XML Document Document doc = Instance of org.w3c.dom.Document; Get a list of all Assertion elements in the document NodeList assrtList = doc.getElementsByTagNameNSSAMLURI.ns_saml, Assertion; if assrtList.getLength == 0 System.err.printlnNo Assertion elements found.; Convert each org.w3c.dom.Node object to a oracle.security.xmlsec.saml.Assertion object and process for int s = 0, n = assrtList.getLength; s n; ++s { Assertion assertion = new AssertionElementassrtList.items; Process Assertion element ... }

9.2.3.1.3 The oracle.security.xmlsec.samlp.Request Class This class represents the

Request element of the SAML Protocol schema. Example 9–4 shows how to create a new Request element and append it to an existing XML document. Example 9–4 Creating a Request Element and Appending to an XML Document Document doc = Instance of org.w3c.dom.Document; Request request = new Requestdoc; doc.getDocumentElement.appendChildrequest; Example 9–5 shows how to obtain Request elements from an existing XML document. Example 9–5 Obtaining Request Elements From an XML Document Document doc = Instance of org.w3c.dom.Document; Get a list of all Request elements in the document NodeList reqList = doc.getElementsByTagNameNSSAMLURI.ns_samlp, Request; if reqList.getLength == 0 System.err.printlnNo Request elements found.; Convert each org.w3c.dom.Node object to a oracle.security.xmlsec.samlp.Request object and process Oracle SAML 9-5 for int s = 0, n = reqList.getLength; s n; ++s { Request request = new RequestElementreqList.items; Process Request element ... }

9.2.3.1.4 The oracle.security.xmlsec.samlp.Response Class This class represents the

Response element of the SAML Protocol schema. Example 9–6 shows how to create a Response element and append it to an existing XML document. Example 9–6 Creating a Response Element and Appending to an XML Document Document doc = Instance of org.w3c.dom.Document; Response response = new Responsedoc; doc.getDocumentElement.appendChildresponse; Example 9–7 shows how to obtain Response elements from an existing XML document. Example 9–7 Obtaining Response Elements From an XML Document Document doc = Instance of org.w3c.dom.Document; Get a list of all Response elements in the document NodeList respList = doc.getElementsByTagNameNSSAMLURI.ns_samlp, Response; if respList.getLength == 0 System.err.printlnNo Response elements found.; Convert each org.w3c.dom.Node object to a oracle.security.xmlsec.samlp.Response object and process for int s = 0, n = respList.getLength; s n; ++s { Response response = new ResponseElementrespList.items; Process Response element ... }

9.2.3.2 Supporting Classes and Interfaces