Fusion Middleware Documentation
Advanced Search


Securing Web Services and Managing Policies with Oracle Web Services Manager
Close Window

Table of Contents

Show All | Collapse

8 Configuring Transport-Level Security (SSL)

Secure Socket Layer (SSL) is a transport-level security protocol. SSL can be either one-way or two-way. With one-way SSL, the server is required to present a certificate to the client but the client is not required to present a certificate to the server. With two-way SSL, the server presents a certificate to the client and the client presents a certificate to the server. To use SSL, you must set up keystores and truststores in your environment.

For more information on SSL, see "Understanding Transport-level and Application-level Security" in Understanding Oracle Web Services Manager.

This chapter contains the following sections:

8.1 Configuring Keystores for SSL

If you want to use any of the policies listed in "Which Policies Require You to Configure SSL?" or "Which Policies Require You to Configure Two-Way SSL?", or you want to use SSL with the OWSM Policy Manager, you must configure keystores for SSL.

SSL provides secure connections by allowing two applications connecting over a network to authenticate the other's identity and by encrypting the data exchanged between the applications.

Authentication allows a client, and optionally a server, to verify the identity of the application on the other end of a network connection. Encryption makes data transmitted over the network intelligible only to the intended recipient. A client certificate (two-way SSL) can be used to authenticate the user.

This section describes the following topics:

8.1.1 How to Configure a KSS Keystore on WebLogic Server

As described in "Managing Keys and Certificates with the Keystore Service" in Securing Applications with Oracle Platform Security Services, the OPSS Keystore Service provides an alternate mechanism to manage keys and certificates for message security. You use the OPSS Keystore Service to create and maintain keystores of type KSS.

This section briefly summarizes the steps that are required to configure the OPSS Keystore Service in WebLogic Server. See the following two sources for complete information:

This section describes the following topics:

8.1.1.1 Configuring the OPSS Keystore Service for Demo Identity and Trust

The KSS demo identity and demo trust keystores are preconfigured when you create a domain, and no additional configuration of these keystores is required.

Perform the following steps to configure the OPSS Keystore Service for demo identity and trust:

  1. From the WebLogic Server Administration Console, navigate to the Domain -> Security -> Advanced page, and enable the "Use KSS For Demo" check box.

  2. Configure the WebLogic Server instance to use Demo Identity and Demo Trust, as described in Configure keystores.

  3. Configure SSL for the WebLogic Server instance, as described in "Configuring SSL on WebLogic Server (One-Way)" and "Configuring SSL on WebLogic Server (Two-Way)".

    Remember that the WebLogic Server DefaultHostnameVerifier has been modified to accept the non-standard DemoCertFor_<WLS Domain Name> hostname format. Other hostname verifiers may not support this format.

  4. Restart WebLogic Server.

8.1.1.2 Recreating the OPSS Keystore Service for Demo Identity and Trust

The KSS demo identity keystore is preconfigured when you create a domain, and no additional configuration of this keystore is required.

However, in case you have subsequently changed or removed the KSS demo identity keystore, use the instructions in this section to recreate the keystore.

You can perform the OPSS Keystore Service operations using either Fusion Middleware Control or the Keystore Service commands with WLST. This section demonstrates the Fusion Middleware Control steps, but "Managing Keys and Certificates with the Keystore Service" describes both options.

Perform the following steps to configure an OPSS Keystore Service for demo identity and trust:

  1. Launch Fusion Middleware Control.

  2. From the WebLogic Domain menu, select Security then Keystore.

  3. Create a keystore named demoidentity in the system stripe. (See "Creating a Keystore with Fusion Middleware Control" for more information.)

    1. Select the system stripe and click Create Keystore.

      The Create Keystore page is shown in Figure 8-1.

      Figure 8-1 Create Keystore

      Description of Figure 8-1 follows
      Description of "Figure 8-1 Create Keystore"

    2. Name this keystore demoidentity.

    3. Set the protection type to Password.

    4. Set the password to DemoIdentityKeyStorePassPhrase, and confirm.

    5. Uncheck the Grant Permission check box.

    6. Do not specify a code base URL.

  4. Select the demoidentity keystore you just created and click Manage.

    Enter the DemoIdentityKeyStorePassPhrase password.

    The Manage Certificates screen shown in Figure 8-2 appears.

    Figure 8-2 Manage Certificates

    Description of Figure 8-2 follows
    Description of "Figure 8-2 Manage Certificates"

  5. Click Generate Keypair to generate a private/public key pair.

    The Generate Keypair screen is shown in Figure 8-3.

    Figure 8-3 Generate Keypair

    Description of Figure 8-3 follows
    Description of "Figure 8-3 Generate Keypair"

    1. Specify DemoIdentity as the alias for the key pair.

    2. Specify the Common Name as DemoCertFor_<WLS Domain Name>, where DemoCertFor_ is a required constant and <WLS Domain Name> is the WebLogic Server domain name. For Example: DemoCertFor_base_domain.

      Note:

      The WebLogic Server DefaultHostnameVerifier has been modified to accept this non-standard hostname format when you set the "Use KSS For Demo" flag in the security configuration for the Weblogic Server domain. Other hostname verifiers may not support this format.

    3. Specify other site-specific information as appropriate.

    4. You can accept the default RSA key size if appropriate for your environment. Oracle requires a key length of 1024 bits or larger.

    5. Specify the password as DemoIdentityPassPhrase.

    6. Click OK.

  6. From the WebLogic Server Administration Console, navigate to the Domain -> Security -> Advanced page, and enable the "Use KSS For Demo" check box.

  7. Configure the WebLogic Server instance to use Demo Identity and Demo Trust, as described in Configure keystores.

  8. Configure SSL for the WebLogic Server instance, as described in "Configuring SSL on WebLogic Server (One-Way)" and "Configuring SSL on WebLogic Server (Two-Way)".

    Remember that the WebLogic Server DefaultHostnameVerifier has been modified to accept the non-standard DemoCertFor_<WLS Domain Name> hostname format. Other hostname verifiers may not support this format.

  9. Restart WebLogic Server.

8.1.1.3 Configuring the OPSS Keystore Service for Custom Identity and Trust

You must configure the OPSS Keystore Service before you can use it for custom identity and trust with WebLogic Server.

You can perform the OPSS Keystore Service operations using either Fusion Middleware Control or the Keystore Service commands with WLST. This section demonstrates the Fusion Middleware Control steps, but "Managing Keys and Certificates with the Keystore Service" describes both options.

Perform the following steps to configure an OPSS Keystore Service for custom identity and trust:

  1. Launch Fusion Middleware Control.

  2. From the WebLogic Domain menu, select Security then Keystore.

  3. Create a keystore in the system stripe. (See "Creating a Keystore with Fusion Middleware Control" for more information.)

    1. Select the system stripe and click Create Keystore.

      The Create Keystore page is shown in Figure 8-4.

      Figure 8-4 Create Keystore

      Description of Figure 8-4 follows
      Description of "Figure 8-4 Create Keystore"

    2. Name this keystore.

    3. Set the protection type to Password.

    4. Set the password.

    5. Uncheck the Grant Permission check box.

    6. Do not specify a code base URL.

  4. Select the keystore you just created and click Manage.

    Enter the password.

    The Manage Certificates screen shown in Figure 8-5 appears.

    Figure 8-5 Manage Certificates

    Description of Figure 8-5 follows
    Description of "Figure 8-5 Manage Certificates"

  5. Click Generate Keypair to generate a private/public key pair.

    The Generate Keypair screen is shown in Figure 8-6.

    Figure 8-6 Generate Keypair

    Description of Figure 8-6 follows
    Description of "Figure 8-6 Generate Keypair"

    1. Specify the alias for the key pair.

    2. Specify site-specific information as appropriate.

    3. You can accept the default RSA key size if appropriate for your environment. Oracle requires a key length of 1024 bits or larger.

    4. Specify the password.

    5. Click OK.

  6. You have the option to use this KSS Demo CA-signed key pair as-is, or to obtain a signed certificate from a reputable vendor such as Entrust, Verisign, and so forth.

    To obtain the signed certificate from a reputable vendor, select the alias for the key pair and click Generate CSR. After you create a CSR, send it to your CA, which will authenticate the certificate request and create a digital certificate based on the request.

    See "Importing a Certificate with Fusion Middleware Control" in Securing Applications with Oracle Platform Security Services for instructions on how to import the CA-signed certificate.

  7. If you do not use the preconfigured OPSS Keystore Service trust store kss://system/trust, you must create your own.

    Note:

    Oracle recommends you use the OPSS Keystore Service trust store because it simplifies trust configuration.

    To create your own trust store, create another OPSS Keystore Service keystore, and import trusted certificates. See "Importing a Certificate with Fusion Middleware Control" in Securing Applications with Oracle Platform Security Services for instructions on how to import trusted certificates.

  8. Configure the WebLogic Server instance to use KSS for Custom Identity and Trust, as described in Configure keystores. You specify the fully-qualified path to the key store as the URI in the form kss://system/keystore-name. The keystore type is KSS.

  9. Configure SSL for the WebLogic Server instance, as described in "Configuring SSL on WebLogic Server (One-Way)" and "Configuring SSL on WebLogic Server (Two-Way)".

All the server SSL attributes are dynamic; when modified via the Console, they cause the corresponding SSL server or channel SSL server to restart and use the new settings for new connections. Old connections will continue to run with the old configuration. To ensure that all the SSL connections exist according to the specified configuration, you must reboot WebLogic Server.

8.1.2 How to Configure a JKS Keystore on WebLogic Server

You may find that using the KSS Keystore Service as described in "How to Configure a KSS Keystore on WebLogic Server" is the most convenient method of configuring a keystore. However, you also have the option of using a JKS keystore, including the WebLogic default identity keystore DemoIdentity.jks and the default trust keystore DemoTrust.jks.

This section briefly summarizes the steps that are required to configure the JKS keystore in WebLogic Server. See the following two sources for complete information:

WebLogic Server is configured with a default identity keystore DemoIdentity.jks and a default trust keystore DemoTrust.jks. In addition, WebLogic Server trusts the certificate authorities in the cacerts file in the JDK. This default keystore configuration is appropriate for testing and development purposes. However, these keystores should not be used in a production environment.

To configure identity and trust for a server:

  1. Obtain trusted certificates from the keytool utility, or a reputable vendor such as Entrust or Verisign, and include them in the keystore.

    To get the certificate, you must create a Certificate Request and submit it to the CA. The CA will authenticate the certificate requestor and create a digital certificate based on the request.

    The PEM (Privacy Enhanced Mail) format is the preferred format for private keys, digital certificates, and trusted certificate authorities (CAs).

    If you use the keytool utility, the default key pair generation algorithm is Digital Signature Algorithm (DSA). WebLogic Server does not support DSA. Specify another key pair generation and signature algorithm such as RSA when using WebLogic Server. For more information about the keytool utility, see the keytool-Key and Certificate Management Tool description at http://docs.oracle.com/javase/7/docs/technotes/tools/windows/keytool.html.

    You can also use the digital certificates, private keys, and trusted CA certificates provided by the WebLogic Server kit. The demonstration digital certificates, private keys, and trusted CA certificates should be used only in a development environment.

  2. Create one keystore for identity and one for trust. The preferred keystore format is JKS (Java KeyStore).

  3. Load the private keys and trusted CAs into the keystores.

  4. In the left pane of the Console, expand Environment and select Servers.

  5. Click the name of the server for which you want to configure the identity and trust keystores.

  6. Select Configuration, and then Keystores.

  7. In the Keystores field, select the method for storing and managing private keys/digital certificate pairs and trusted CA certificates. These options are available:

    • Custom Identity and Custom Trust: Identity and trust keystores you create.

    • Demo Identity and Demo Trust: The demonstration identity and trust keystores, located in the DOMAIN_HOME\security and WL_HOME\server\lib directories respectively, and the JDK cacerts keystore, are configured by default. Use for development only.

    • Custom Identity and Java Standard Trust: A keystore you create and the trusted CAs defined in the cacerts file in the JAVA_HOME\jre\lib\security directory.

    • Custom Identity and Command Line Trust: An identity keystore you create and command-line arguments that specify the location of the trust keystore.

  8. In the Identity section, define attributes for the identity keystore.

    • Custom Identity Keystore: The fully qualified path to the identity keystore.

    • Custom Identity Keystore Type: The type of the keystore. Generally, this attribute is Java KeyStore (JKS); if left blank, it defaults to JKS.

    • Custom Identity Keystore Passphrase: The password you will enter when reading or writing to the keystore. This attribute is optional or required depending on the type of keystore. All keystores require the passphrase to write to the keystore. However, some keystores do not require the passphrase to read from the keystore. WebLogic Server only reads from the keystore so whether or not you define this property depends on the requirements of the keystore.

      Note:

      The passphrase for the Demo Identity keystore is DemoIdentityKeyStorePassPhrase.

  9. In the Trust section, define properties for the trust keystore.

    If you chose Java Standard Trust as your keystore, specify the password defined when creating the keystore. Confirm the password.

    If you chose Custom Trust, define the following attributes:

    • Custom Trust Keystore: The fully qualified path to the trust keystore.

    • Custom Trust Keystore Type: The type of the keystore. Generally, this attribute is JKS; if left blank, it defaults to JKS.

    • Custom Trust Keystore Passphrase: The password you will enter when reading or writing to the keystore. This attribute is optional or required depending on the type of keystore. All keystores require the passphrase to write to the keystore. However, some keystores do not require the passphrase to read from the keystore. WebLogic Server only reads from the keystore, so whether or not you define this property depends on the requirements of the keystore.

  10. The changes are automatically activated.

8.2 Configuring SSL on WebLogic Server (One-Way)

With one-way SSL, the server is required to present a certificate to the client but the client is not required to present a certificate to the server.

After you configure identity and trust keystores for a WebLogic Server instance as described in "Configuring Keystores for SSL", you configure its SSL attributes. These attributes describe the location of the identity key and certificate in the keystore specified on the Configuration: Keystores page. Use the Configuration: SSL page to specify this information.

This section summarizes the steps required to configure SSL on WebLogic Server. For complete information, see Administering Security for Oracle WebLogic Server.

To configure SSL:

  1. In the left pane of the WebLogic Server Administration Console, expand Environment and select Servers.

  2. Click the name of the server for which you want to configure SSL.

  3. Select Configuration, and then the SSL page, and choose the location of identity (certificate and private key) and trust (trusted CAs) for WebLogic Server.

  4. Set SSL attributes for the private key alias and password.

  5. At the bottom of the page, click Advanced.

  6. Set Hostname Verification to None.

  7. Indicate the number of times WebLogic Server can use an exportable key between a domestic server and an exportable client before generating a new key. The more secure you want WebLogic Server to be, the fewer times the key should be used before generating a new key.

  8. Set the Two Way Client Cert Behavior control to Client Certs Not Requested.

  9. Specify the inbound and outbound SSL certificate validation methods. These options are available:

    • Builtin SSL Validation Only: Uses the built-in trusted CA-based validation. This is the default.

    • Built-in SSL Validation and Cert Path Validators: Uses the built-in trusted CA-based validation and uses configured CertPathValidator providers to perform extra validation.

8.3 Configuring SSL on WebLogic Server (Two-Way)

With two-way SSL, the server presents a certificate to the client and the client presents a certificate to the server. WebLogic Server can be configured to require clients to submit valid and trusted certificates before completing the SSL handshake.

After you configure identity and trust keystores for a WebLogic Server instance as described in "Configuring Keystores for SSL", you can configure its two-way SSL attributes if the policy or template you are using requires it, as described in "Which Policies Require You to Configure Two-Way SSL?".

This section summarizes the steps required to configure SSL on WebLogic Server. For complete information, see Administering Security for Oracle WebLogic Server.

To configure two-way SSL:

  1. In the left pane of the WebLogic Server Administration Console, expand Environment and select Servers.

  2. Click the name of the server for which you want to configure SSL.

  3. Select Configuration, and then the SSL page, and choose the location of identity (certificate and private key) and trust (trusted CAs) for WebLogic Server.

  4. Set SSL attributes for the private key alias and password.

  5. At the bottom of the page, click Advanced.

  6. Set Hostname Verification to None.

  7. Indicate the number of times WebLogic Server can use an exportable key between a domestic server and an exportable client before generating a new key. The more secure you want WebLogic Server to be, the fewer times the key should be used before generating a new key.

  8. Set the Two Way Client Cert Behavior control to Client Certs Requested and Enforced.

  9. Specify the inbound and outbound SSL certificate validation methods. These options are available:

    • Builtin SSL Validation Only: Uses the built-in trusted CA-based validation. This is the default.

    • Builtin SSL Validation and Cert Path Validators: Uses the built-in trusted CA-based validation and uses configured CertPathValidator providers to perform extra validation.

8.4 Configuring SSL for a Web Service Client

The core WebLogic Server security subsystem uses private key and X.509 certificate pairs, stored in the default keystores, for SSL.

You must ensure that the Web service client trusts the X.509 certificate that WebLogic Server uses to digitally sign the request. Do one of the following:

  • Ensure that WebLogic Server obtains a digital certificate that the client automatically trusts, because it has been issued by a trusted certificate authority.

  • Create a certificate registry that lists all the individual certificates trusted by WebLogic Server, and then ensure that the client trusts these registered certificates.

  • If the client and WebLogic Server are on the same system, have them use the same trust store.

To configure one-way SSL for a Web services client, you set the following properties in the client's JVM:

  • javax.net.ssl.trustStore -- The system property that specifies the trust store location. For JKS it is the name of the file that contains the trust store. For KSS it is the KSS URI.

    You can either use the existing JKS or KSS trust store, or create a new one. For example, you can have javax.net.ssl.trustStore point to the default kss://system/trust trust store .

    To create a new JKS trust store you can use the keytool utility. To create a new KSS keystore you can use Fusion Middleware Control.

  • javax.net.ssl.trustStoreType -- The type of trust store object that you want the default TrustManager to use, either JKS or KSS.

  • javax.net.ssl.trustStorePassword -- JKS only. Specifies the trust store's password.

For Oracle Infrastructure Web service clients, you can also set individual properties in their descriptor files. The properties set in individual descriptor files override properties set using the system properties:

  • For a SOA composite, set the properties in composite.xml.

  • For ADF Web service data control (ADFDC), set the properties in connections.xml.

  • For ADF business components and WebCenter clients, set the properties in oracle-webservices-client.xml.

8.5 Configuring Two-Way SSL for a Web Service Client

Note:

See "Configuring SOA Composite Applications for Two-Way SSL Communication" in Administering Oracle SOA Suite and Oracle Business Process Management Suite for specific configuration steps when a SOA application is the Web service client over two-way SSL.

You must ensure that WebLogic Server is able to validate the X.509 certificate that the client uses to digitally sign its request, and that WebLogic Server in turn uses to encrypt its responses to the client. Do one of the following:

  • Ensure that the client application obtains a digital certificate that WebLogic Server automatically trusts, because it has been issued by a trusted certificate authority.

  • Create a certificate registry that lists all the individual certificates trusted by WebLogic Server, and then ensure that the client uses one of these registered certificates.

  • If the client and WebLogic Server are on the same system, have them use the same key store and trust store.

To configure SSL for a Web service client, make sure that the following properties are set in the client's JVM:

  • javax.net.ssl.keyStore -- The system property that specifies the keystore location. For JKS it is the name of the file that contains the key store. For KSS it is the KSS URI.

    You can either use the existing JKS or KSS key store, or create a new one. For example, you can have javax.net.ssl.keyStore point to the default kss://system/castore key store so that the Web service client uses the X.509 certificates that WebLogic Server uses.

    To create a new JKS key store you can use the keytool utility. To create a new KSS keystore you can use Fusion Middleware Control.

  • javax.net.ssl.keyStoreType -- The type of KeyStore object that you want the default TrustManager to use, either JKS or KSS.

  • javax.net.ssl.trustStore -- The system property that specifies the trust store location. For JKS it is the name of the file that contains the trust store. For KSS it is the KSS URI.

    You can either use the existing JKS or KSS trust store, or create a new one. For example, you can have javax.net.ssl.trustStore point to the default kss://system/trust trust store so that the Web service client trusts the X.509 certificates that WebLogic Server trusts.

    To create a new JKS trust store you can use the keytool utility. To create a new KSS keystore you can use Fusion Middleware Control.

  • javax.net.ssl.trustStoreType -- The type of TrustStore object that you want the default TrustManager to use, either JKS or KSS.

  • javax.net.ssl.trustStorePassword -- JKS only. Specifies the trust store's password.

  • HTTPClient.ssl.identityAlias -- The alias of the certificate you want to use for identity. If the alias is null, the JSSE provider chooses one of the aliases in the keystore.

For Oracle Infrastructure Web service clients, you can also set individual properties in their descriptor files. The properties set in individual descriptor files override properties set using the system properties:

  • For a SOA composite, set the properties in composite.xml.

  • For ADF Web service data control (ADFDC), set the properties in connections.xml.

  • For ADF business components and WebCenter clients, set the properties in oracle-webservices-client.xml.

8.6 Configuring SSL on Oracle HTTP Server

The HTTPS protocol uses an industry standard protocol called Secure Sockets Layer (SSL) to establish secure connections between clients and servers. You can use the HTTPS/SSL support offered by the Oracle HTTP Server as one of the communication protocols to communicate between the client and the Web service. This section describes how to set up a Web service client and a Web service using OWSM policies to send requests over SSL. Oracle HTTP Server is configured as a Web proxy that intermediates between the client and Oracle WebLogic Server. SSL is enabled at Oracle HTTP Server and SSL transport is turned on between the client and Oracle HTTP Server. Communication remains non-SSL between Oracle HTTP Server and WebLogic Server. This section describes how to configure the policies that require one-way SSL and two-way SSL.

For more information, see:

8.6.1 One-Way SSL

For more information on the OWSM policies that require one-way SSL configuration, see "Which Policies Require You to Configure SSL?".

To use one-way SSL, you need to:

  1. Configure the Oracle HTTP Server as follows:

    1. In the file ORACLE_INSTANCE/config/OHS/<ohs_name>/ssl.conf, configure Oracle HTTP Server as a Web proxy and specify the list of URLs you want to access, as shown in Example 8-1.

      Example 8-1 Specifying URLs in ssl.conf

      # added properties for configuring OHS as webproxy
      <IfModule weblogic_module>
      WebLogicHost <host>
      WebLogicPort <port>
      SecureProxy Off
      WlProxySSL On
      Debug ALL
      WlLogFile /tmp/weblogic.log
      #the location attributes list the urls you want to access via OHS
      <Location
       /myWlsService>
              SetHandler weblogic-handler
              WebLogicHost <host>
              WeblogicPort <port>
      </Location>
       
      
    2. In the same file, set the following properties under virtual host configuration to ensure the client certificate information is sent to WebLogic Server:

      SSLVerifyClient optional

    3. By default, SSL in enabled on Oracle HTTP Server. The default https port is 4443. For more information on configuring this port, see "Configuring SSL in Oracle Fusion Middleware" in Administering Oracle Fusion Middleware.

    4. Restart Oracle HTTP Server.

      For more information, see "Configuring SSL in Oracle Fusion Middleware" in Administering Oracle Fusion Middleware.

  2. Create a wallet as described at "Managing Keystores, Wallets, and Certificates" in Administering Oracle Fusion Middleware and replace the default wallet. The default wallet is located in the ORACLE_INSTANCE/config/OHS/<ohs_name>/keystores/default directory. See Example 8-2 for sample commands for creating a wallet.

    Example 8-2 Sample Commands for One-Way SSL

    ./orapki wallet create -wallet <wallet_location> -pwd password -auto_login
    ./orapki wallet display -wallet <wallet_location> -pwd password
    ./orapki cert display -cert <wallet_location>/ohs.crt
        
    ./orapki wallet add -wallet <wallet_location> -keysize 512 -dn "CN=<host_name>,OU=st,O=owsm,L=N,ST=delhi,C=IN"
    -self_signed -validity 700 -serial_num 20 -cert <wallet_location>/ohs.crt -user_cert -pwd password
        
    ./orapki wallet display -wallet <wallet_location> -pwd password
        
    JAVA_HOME/bin/keytool -import -trustcacerts -file ohs.crt -alias sslcert -keystore client_keystore.jks -storepass password
    
  3. In the Oracle WebLogic Administration Console, perform the following:

    1. Navigate to the Servers page in the Environment tab.

    2. Click Adminserver and in Configuration, select General.

    3. In the Advanced section, check the following: WebLogic Plug-In Enabled, and Client Cert Proxy Enabled.

    4. Save the changes.

    5. Set the same parameters for the SOA server.

      For more information, see "Server: Configuration: General" in the Oracle WebLogic Server Administration Console Online Help.

To modify the client to use one-way (server authentication mode), create a JSE client from the Web service using JDeveloper. Modify the parameters and properties as described in Example 8-3.

Example 8-3 JSE Client Using SSL

public static void main(String [] args)
  {
    class1Service = new Class1Service();   
        SecurityPolicyFeature[] securityFeatures =
            new SecurityPolicyFeature[] { new SecurityPolicyFeature("oracle/wss_
saml_token_over_ssl_client_policy") };
    Class1 class1 = class1Service.getClass1Port(securityFeatures);       
    ((BindingProvider) class1).getRequestContext().put(BindingProvider.ENDPOINT_
ADDRESS_PROPERTY,
        "https://<host>:4443/myWlsService/Class1Port");
       
    ((BindingProvider) class1).getRequestContext().put(BindingProvider.USERNAME_
PROPERTY, "weblogic");
    System.setProperty("javax.net.ssl.trustStore","D:\\OWSM_
QA\\11g\\PS2\\OHS\\wallet\\client_keystore.jks");
    System.setProperty("javax.net.ssl.trustStorePassword","password");
    System.setProperty("javax.net.ssl.trustStoreType","JKS");   
   
    System.setProperty("weblogic.security.SSL.ignoreHostnameVerification" ,
 "true");
    System.setProperty("java.protocol.handler.pkgs",
 "com.sun.net.ssl.internal.www.protocol");
    System.setProperty("javax.net.debug","all");       
   
    System.out.println("Call to the SSL service...");           
    String response1 = class1.sayHello("test");
    System.out.println("Response = " + response1);
  }

8.6.2 Two-Way SSL

For more information on the OWSM policies that require two-way SSL configuration, see "Which Policies Require You to Configure Two-Way SSL?".

To use two-way SSL, you need to:

  1. Configure the Oracle HTTP Server as follows:

    1. In the file ORACLE_INSTANCE/config/OHS/<ohs_name>/ssl.conf, configure Oracle HTTP Server as a Web proxy and specify the list of URLs you want to access as shown in Example 8-4.

      Example 8-4 Specifying URLs in ssl.conf

      # added properties for configuring OHS as webproxy
      <IfModule weblogic_module>
      WebLogicHost <host>
      WebLogicPort <port>
      SecureProxy Off
      WlProxySSL On
      Debug ALL
      WlLogFile /tmp/weblogic.log
      #the location attributes list the urls you want to access via OHS
      <Location /myWlsService>
              SetHandler weblogic-handler
              WebLogicHost <host>
              WeblogicPort <port>
      </Location>
      
    2. In the same file, set the following properties under virtual host configuration to ensure the client certificate information is sent to the WebLogic Server:

      SSLVerifyClient optional

      SSLOptions +StdEnvVars +ExportCertData

      SSLOptions +ExportCertData is a mod_ssl directive that ensures certificate-related information is sent to WebLogic Server. SSLOptions +StdEnvVars +ExportCertData ensures that SSL-related information is sent.

    3. By default, SSL in enabled on Oracle HTTP Server. The default https port is 4443. For more information on configuring this port, see "Configuring SSL in Oracle Fusion Middleware" in Administering Oracle Fusion Middleware.

    4. Restart Oracle HTTP Server.

      For more information, see "Configuring SSL in Oracle Fusion Middleware" in Administering Oracle Fusion Middleware.

  2. Create a wallet as described at "Managing Keystores, Wallets, and Certificates" in Administering Oracle Fusion Middleware and replace the default wallet. The default wallet is located in the ORACLE_INSTANCE/config/OHS/<ohs_name>/keystores/default directory. See Example 8-5 for sample commands.

    Example 8-5 Sample Commands for Two-Way SSL

    JAVA_HOME/bin/keytool -genkey -alias twowayssl -keyalg RSA
     -keystore twowaykeystore.jks -storepass password -validity 700
    ./orapki wallet add -wallet <wallet_location> -cert
     <wallet_location>/twowayssl.crt -trusted_cert -pwd password
    
  3. In the Oracle WebLogic Administration Console, perform the following:

    1. Navigate to the Servers page in the Environment tab.

    2. Click Adminserver and in Configuration, select General.

    3. In the Advanced section, check the following: WebLogic Plug-In Enabled, and Client Cert Proxy Enabled.

    4. Save the changes.

    5. Set the same parameters for the SOA server.

      For more information, see "Server: Configuration: General" in the Oracle WebLogic Server Administration Console Online Help.

To modify the client to use two-way (mutual authentication mode) SSL, create a JSE client from the Web service using JDeveloper. Modify the parameters and properties as described in Example 8-6.

Example 8-6 JSE Client Using SSL

public static void main(String [] args)
  {
    class1Service = new Class1Service();   
        SecurityPolicyFeature[] securityFeatures =
            new SecurityPolicyFeature[] { new SecurityPolicyFeature("oracle/wss_saml_token_over_ssl_client_policy") };
    Class1 class1 = class1Service.getClass1Port(securityFeatures);       
    ((BindingProvider) class1).getRequestContext().put(BindingProvider.ENDPOINT_
ADDRESS_PROPERTY,
        "https://<host>:4443/myWlsService/Class1Port");
       
    ((BindingProvider) class1).getRequestContext().put(BindingProvider.USERNAME_
PROPERTY, "weblogic");
    ((BindingProvider) class1).getRequestContext().put(BindingProvider.PASSWORD_
PROPERTY, "password");
    System.setProperty("javax.net.ssl.trustStore","D:\\OWSM_
QA\\11g\\PS2\\OHS\\wallet\\twowaykeystore.jks");  
    System.setProperty("javax.net.ssl.trustStorePassword","password");
    System.setProperty("javax.net.ssl.trustStoreType","JKS");   
    System.setProperty("javax.net.ssl.keyStore","D:\\OWSM_QA\\11g\\PS2\\OHS\\wallet\\twowaykeystore.jks");
    System.setProperty("javax.net.ssl.keyStorePassword","password");
    System.setProperty("javax.net.ssl.keyStoreType","JKS");   
   
    System.setProperty("weblogic.security.SSL.ignoreHostnameVerification" ,
 "true");
    System.setProperty("java.protocol.handler.pkgs",
 "com.sun.net.ssl.internal.www.protocol");
    System.setProperty("javax.net.debug","all");       
   
    System.out.println("Call to the SSL service...");           
    String response1 = class1.sayHello("test");
    System.out.println("Response = " + response1);
  }