Core Classes and Interfaces

Oracle Liberty SDK 11-3 For example, your CLASSPATH might look like this: CLASSPATH;ORACLE_HOME\modules\oracle.osdt_11.1.1\osdt_core.jar; ORACLE_HOME\modules\oracle.osdt_11.1.1\osdt_cert.jar; 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\org.jaxen_1.1.1.jar; ORACLE_HOME\modules\oracle.osdt_11.1.1\osdt_lib_v11.jar;

6. Click OK.

11.2.1.2.2 Setting the CLASSPATH on UNIX To set your CLASSPATH on UNIX, set your

CLASSPATH environment variable to include the full path and file name of all of 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_HOMEmodulesorg.jaxen_1.1.1.jar: ORACLE_HOMEmodulesoracle.osdt_11.1.1osdt_lib_v11.jar

11.2.2 Overview of Oracle Liberty 1.1 Classes and Interfaces

This section introduces some useful classes and interfaces of Oracle Liberty SDK v. 1.1. It contains these topics: ■ Core Classes and Interfaces ■ Supporting Classes and Interfaces

11.2.2.1 Core Classes and Interfaces

This section describes core classes and interfaces of the Oracle Liberty SDK v. 1.1. The core classes are: ■ The oracle.security.xmlsec.liberty.v11.AuthnRequest Class ■ The oracle.security.xmlsec.liberty.v11.AuthnResponse Class ■ The oracle.security.xmlsec.liberty.v11.FederationTerminationNotification Class ■ The oracle.security.xmlsec.liberty.v11.LogoutRequest Class ■ The oracle.security.xmlsec.liberty.v11.LogoutResponse Class ■ The oracle.security.xmlsec.liberty.v11.RegisterNameIdentifierRequest Class ■ The oracle.security.xmlsec.liberty.v11.RegisterNameIdentifierResponse Class

11.2.2.1.1 The oracle.security.xmlsec.liberty.v11.AuthnRequest Class

This class represents the AuthnRequest element of the Liberty protocol schema. Example 11–1 shows how to create a new AuthnRequest element and append it to a document. Example 11–1 Creating an AuthnRequest Element and Appending it to a Document Document doc = Instance of org.w3c.dom.Document; AuthnRequest authnRequest = new AuthnRequestdoc; doc.getDocumentElement.appendChildauthnRequest; 11-4 Oracle Fusion Middleware Reference for Oracle Security Developer Tools Example 11–2 shows how to obtain AuthnRequest elements from an XML document. Example 11–2 Obtaining AuthnRequest Elements from a Document Document doc = Instance of org.w3c.dom.Document; Get list of all AuthnRequest elements in the document. NodeList arList = doc.getElementsByTagNameNSLibertyURI.ns_liberty, AuthnRequest; if arList.getLength == 0 System.err.printlnNo AuthnRequest elements found.; Convert each org.w3c.dom.Node object to an oracle.security.xmlsec.liberty.v11.AuthnRequest object and process for int s = 0, n = arList.getLength; s n; ++s { AuthnRequest authnRequest = new AuthnRequestElementarList.items; Process AuthnRequest element ... } 11.2.2.1.2 The oracle.security.xmlsec.liberty.v11.AuthnResponse Class This class represents the AuthnResponse element of the Liberty protocol schema. Example 11–3 shows how to create a new AuthnResponse element and append it to a document. Example 11–3 Creating an AuthnResponse Element and Appending it to a Document Document doc = Instance of org.w3c.dom.Document; AuthnResponse authnResponse = new AuthnResponsedoc; doc.getDocumentElement.appendChildauthnResponse; Example 11–4 shows how to obtain AuthnResponse elements from an XML document. Example 11–4 Obtaining AuthnResponse elements from a Document Document doc = Instance of org.w3c.dom.Document; Get list of all AuthnResponse elements in the document. NodeList arList = doc.getElementsByTagNameNSLibertyURI.ns_liberty, AuthnResponse; if arList.getLength == 0 System.err.printlnNo AuthnResponse elements found.; Convert each org.w3c.dom.Node object to an oracle.security.xmlsec.liberty.v11.AuthnResponse object and process for int s = 0, n = arList.getLength; s n; ++s { AuthnResponse authnResponse = new AuthnResponseElementarList.items; Process AuthnResponse element ... } 11.2.2.1.3 The oracle.security.xmlsec.liberty.v11.FederationTerminationNotification Class Oracle Liberty SDK 11-5 This class represents the FederationTerminationNotification element of the Liberty protocol schema. Example 11–5 shows how to create a new federation termination notification element and append it to a document. Example 11–5 Creating a FederationTerminationNotification Element and Appending it to a Document Document doc = Instance of org.w3c.dom.Document; FederationTerminationNotification ftn = new FederationTerminationNotificationdoc; doc.getDocumentElement.appendChildftn; Example 11–6 shows how to obtain federation termination notification elements from an XML document. Example 11–6 Obtaining FederationTerminationNotification Elements from a Document Document doc = Instance of org.w3c.dom.Document; Get list of all FederationTerminationNotification elements in the document NodeList ftnList = doc.getElementsByTagNameNSLibertyURI.ns_liberty, FederationTerminationNotification; if ftnList.getLength == 0 System.err.printlnNo FederationTerminationNotification elements found.; Convert each org.w3c.dom.Node object to an oracle.security.xmlsec.liberty.v11.FederationTerminationNotification object and process for int s = 0, n = ftnList.getLength; s n; ++s { FederationTerminationNotification ftn = new FederationTerminationNotificationElementftnList.items; Process FederationTerminationNotification element ... }

11.2.2.1.4 The oracle.security.xmlsec.liberty.v11.LogoutRequest Class

This class represents the LogoutRequest element of the Liberty protocol schema. Example 11–7 shows how to create a new LogoutRequest element and append it to a document. Example 11–7 Creating a LogoutRequest Element and Appending it to a Document Document doc = Instance of org.w3c.dom.Document; LogoutRequest lr = new LogoutRequestdoc; doc.getDocumentElement.appendChildlr; Example 11–8 shows how to obtain LogoutRequest elements from an XML document. Example 11–8 Obtaining LogoutRequest Elements from an XML Document Document doc = Instance of org.w3c.dom.Document; Get list of all LogoutRequest elements in the document. 11-6 Oracle Fusion Middleware Reference for Oracle Security Developer Tools NodeList lrList = doc.getElementsByTagNameNSLibertyURI.ns_liberty, LogoutRequest; if lrList.getLength == 0 System.err.printlnNo LogoutRequest elements found.; Convert each org.w3c.dom.Node object to an oracle.security.xmlsec.liberty.v11.LogoutRequest object and process for int s = 0, n = lrList.getLength; s n; ++s { LogoutRequest lr = new LogoutRequestElementlrList.items; Process LogoutRequest element ... }

11.2.2.1.5 The oracle.security.xmlsec.liberty.v11.LogoutResponse Class

This class represents the LogoutResponse element of the Liberty protocol schema. Example 11–9 shows how to create a new LogoutResponse element and append it to a document. Example 11–9 Creating a LogoutResponse Element and Appending it to a Document Document doc = Instance of org.w3c.dom.Document; LogoutResponse lr = new LogoutResponsedoc; doc.getDocumentElement.appendChildlr; Example 11–10 shows how to obtain LogoutResponse elements from an XML document. Example 11–10 Obtaining LogoutResponse elements from a Document Document doc = Instance of org.w3c.dom.Document; Get list of all LogoutResponse elements in the document. NodeList lrList = doc.getElementsByTagNameNSLibertyURI.ns_liberty, LogoutResponse; if lrList.getLength == 0 System.err.printlnNo LogoutResponse elements found.; Convert each org.w3c.dom.Node object to an oracle.security.xmlsec.liberty.v11.LogoutResponse object and process for int s = 0, n = lrList.getLength; s n; ++s { LogoutResponse lr = new LogoutResponseElementlrList.items; Process LogoutResponse element ... }

11.2.2.1.6 The oracle.security.xmlsec.liberty.v11.RegisterNameIdentifierRequest Class

This class represents the RegisterNameIdentifierRequest element of the Liberty protocol schema. Oracle Liberty SDK 11-7 Example 11–11 shows how to create a new RegisterNameIdentifierRequest element and append it to a document. Example 11–11 Creating a RegisterNameIdentifierRequest Element and Appending it to a Document Document doc = Instance of org.w3c.dom.Document; RegisterNameIdentifierRequest rnir = new RegisterNameIdentifierRequestdoc; doc.getDocumentElement.appendChildrnir; Example 11–12 shows how to obtain RegisterNameIdentifierRequest elements from an XML document. Example 11–12 Obtaining RegisterNameIdentifierRequest Elements from an XML Document Document doc = Instance of org.w3c.dom.Document; Get list of all RegisterNameIdentifierRequest elements in the document NodeList rnirList = doc.getElementsByTagNameNSLibertyURI.ns_liberty, RegisterNameIdentifierRequest; if rnirList.getLength == 0 System.err.printlnNo RegisterNameIdentifierRequest elements found.; Convert each org.w3c.dom.Node object to an oracle.security.xmlsec.liberty.v11.RegisterNameIdentifierRequest object and process for int s = 0, n = rnirList.getLength; s n; ++s { RegisterNameIdentifierRequest rnir = new RegisterNameIdentifierRequestElementrnirList.items; Process RegisterNameIdentifierRequest element ... } 11.2.2.1.7 The oracle.security.xmlsec.liberty.v11.RegisterNameIdentifierResponse Class This class represents the RegisterNameIdentifierResponse element of the Liberty protocol schema. Example 11–13 shows how to create a new RegisterNameIdentifierResponse element and append it to a document. Example 11–13 Creating a RegisterNameIdentifierResponse Element and Appending it to a Document Document doc = Instance of org.w3c.dom.Document; RegisterNameIdentifierResponse rnir = new RegisterNameIdentifierResponsedoc; doc.getDocumentElement.appendChildrnir; Example 11–14 shows how to obtain RegisterNameIdentifierResponse elements from an XML document. Example 11–14 Obtaining RegisterNameIdentifierResponse Elements from an XML Document Document doc = Instance of org.w3c.dom.Document; 11-8 Oracle Fusion Middleware Reference for Oracle Security Developer Tools Get list of all RegisterNameIdentifierResponse elements in the document NodeList rnirList = doc.getElementsByTagNameNSLibertyURI.ns_liberty, RegisterNameIdentifierResponse; if rnirList.getLength == 0 System.err.printlnNo RegisterNameIdentifierResponse elements found.; Convert each org.w3c.dom.Node object to an oracle.security.xmlsec.liberty.v11.RegisterNameIdentifierResponse object and process for int s = 0, n = rnirList.getLength; s n; ++s { RegisterNameIdentifierResponse rnir = new RegisterNameIdentifierResponseElementrnirList.items; Process RegisterNameIdentifierResponse element ... }

11.2.2.2 Supporting Classes and Interfaces