I Want Web Services Security To Work With One Instance of OpenSSO
Securing web services communications using OpenSSO entails embedding security information within the SOAP request sent to the web service provider (WSP), and within the response returned to the web service consumer (WSC). The communications may then securely pass through multiple intermediaries (firewalls and load balancers, for example) before reaching its intended receiver. The following sections illustrate how to configure and test secure web services communications using OpenSSO and included samples.
In this simple scenario, the message security is achieved using an instance of OpenSSO that communicates with a security agent deployed on both the WSC and WSP sides. The agent profiles for the deployment are configured using OpenSSO. The following procedures illustrate how to configure for web services security and test the configurations using the OpenSSO Stock Quote Service sample.
- Installing a Web Services Security Agent
- Adding Java Security Permissions
- Deploying the Web Service Client and Web Service Provider Application Sample
- Creating the WSC and WSP Agent Profiles Using OpenSSO
- Testing the Sample
Installing a Web Services Security Agent
Follow this procedure to install each security agent with the Express Build 8 installer (not yet released). Before Express Build 8, use the old installer.- Create a text file that contains the agentAuth password in clear text and save it.
Configured out of the box, agentAuth is an agent profile with permission to read other configured agent profiles including the defaultwsc,wspandSecurityTokenService. The agentAuth password is changeit. - Download openssowssproviders.zip.
- Create a directory to which you will inflate the ZIP.
% mkdir /tmp/wssunzip(or\wssunzipon Windows) - Unzip
openssowssproviders.zipto the directory. - Stop the Glassfish instance on which the agent is to be installed.
- Begin the installation with one of the following steps.
- On UNIX and Linux, change to the
/tmp/wssunzip/bindirectory and runchmod 755 wssagentadmin. Following that, run./wssagentadmin --installor./wssagentadmin --custom-install. - On Windows, change to the
\wssunzip\bindirectory and runwssagentadmin.bat --installorwssagentadmin.bat --custom-install.
--custom-installallows you to specify the application server instance name whereas the--installassumes the instance name to be server. - On UNIX and Linux, change to the
- Review the license information, if applicable.
- Enter the absolute path of the application server domain configuration directory.
- Enter the application server instance name if you ran the installer with the
--custom-installoption.
In the case of Sun Application Server Enterprise Edition, a domain can have more than one application server instance so enter the name of the application server instance in which you are installing the agent. - Enter the OpenSSO deployment URL using the format
protocol://host:port/deployURI.
protocol is eitherhttporhttps; host is the fully qualified domain name of the machine on which OpenSSO is running and deployURI is the OpenSSO deployment URI; by default,opensso. - Enter agentAuth, the user with permission to read the agent profiles.
- Enter the path to the agentAuth password file created at the beginning of this procedure.
- Review the summary and choose Continue with Installation to begin the process.
- Restart the Application Server instance or domain after installation is complete.
Adding Java Security Permissions
If the Glassfish Security Manager is enabled, you must add Java security permissions to all domains used in this deployment. If, for example, the WSC and WSP are deployed in one domain, edit only oneserver.policy file for the both.
- Append the Java security permissions defined in
/tmp/wssunzip/config/OpenSSOJavaPermissions.txtto theserver.policyfile of the specific Application Server domain.
Each Application Server domain has its own standard J2SE policy file namedserver.policylocated in the/ApplicationServer-install/domains/domain-name/configdirectory. - Restart the Application Server instance.
Deploying the Web Service Client and Web Service Provider Application Sample
The web services security sample contains the/tmp/wssunzip/samples/glassfish/StockQuoteClient and /tmp/wssunzip/samples/glassfish/StockService directories for the client and provider respectively. A /tmp/wssunzip/samples/glassfish/glassfish.properties file contains the configuration properties for Glassfish.
Deploying the Web Service Client Sample
- Create a password file for the Glassfish administrator.
The password file should have read permissions and the lineAS_ADMIN_password=password - Edit
glassfish.propertiesas follows:glassfish.home = WSC Glassfish installation directory(for example,/export/glassfishv2ur2/glassfish)glassfish.host = WSC Host where glassfish is installed(for example,opensso.sun.com)glassfish.passwordfile = path to Glassfish administrator password file(for example,/tmp/GFadmin_passwd) - Set JAVA_HOME to JDK1.5 or 1.6 and ensure
javaandjavacare in the PATH. - Replace localhost and 8080 in the
StockQuoteClient/src/java/com/samples/GetQuote.javaandStockQuoteClient/src/java/com/samples/SOAPMessage.javafiles with the fully qualified domain name and port to which the web service provider was deployed.
localhost and 8080 are the default OpenSSO values. These files would need modification if you changed the values for the web service provider during installation. - Change to the
StockQuoteClientdirectory and runWSC-ApplicationServer-install/lib/ant/bin/ant all.
This will build and deploy the Stock Quote Sample Client to the WSC Glassfish container.
Deploying the Web Service Provider Sample
- Create a password file for the Glassfish administrator.
The password file should have read permissions and the lineAS_ADMIN_password=password - Edit
glassfish.propertiesas follows:glassfish.home = WSP Glassfish installation directory(for example,/export/glassfishv2ur2/glassfish)glassfish.host = WSP Host where glassfish is installed(for example,opensso.sun.com)glassfish.passwordfile = path to Glassfish administrator password file(for example,/tmp/GFadmin_passwd) - Set JAVA_HOME to JDK1.5 or 1.6 and ensure
javaandjavacare in the PATH. - Change to the
StockServicedirectory and runWSP-ApplicationServer-install/lib/ant/bin/ant all.
This will build and deploy the Stock Quote Sample Service to the WSP Glassfish container.
Creating the WSC, WSP and STS Agent Profiles Using OpenSSO
The agent profiles for a WSC (wsc), a WSP (wsp), and a Security Token Service (SecurityTokenService) are created when OpenSSO is installed. These can be used with the sample.
- Configure the WSC Agent Profile
- Configure the STS Agent Profile
- Configure the WSP Agent Profile
- Review the Agent Authenticator Profile
Configure the WSC Agent Profile
- Login to the OpenSSO console as the administrator; by default,
amadmin. - Click the Access Control tab.
- Click the top level realm.
- Under the Agents tab, click Web Service Client.
- OPTIONAL: Click New to create the WSC agent profile if you do not see the default
wscin the table.- Enter wsc as the name of the agent profile.
- Define values for any required fields.
- Click Save.
- Click
wscfrom the table to access the profile. - Select the appropriate Security Mechanism.
If you selectSTSSecurityas Security Mechanism, the WSC is requesting that the OpenSSO Security Token Service (STS) generate a token to secure the request to the WSP. See To Configure the STS Agent Profile to create a profile for the Security Token Service. - Check Is Request Signed.
- Check Preserve Security Headers in Message.
- Specify
http://wsp-host-name:portnumber/StockService/StockServiceas the Web Service End Point. - Save the changes.
- Click Back to Main Page.
Configure the Security Token Service Agent Profile
If you did not selectSTSSecurity as the Security Mechanism in To Configure the WSC Agent Profile, skip this procedure.
- Under the Agents tab, click STS Client.
- OPTIONAL: Click New to create the Security Token Service agent profile if you do not see the default
SecurityTokenServicein the table.- Enter SecurityTokenService as the name of the agent profile.
- Define values for any required fields.
- Click Save.
- ClickSecurityTokenService from the table to access the profile.
- Select the appropriate Security Mechanism.
- Enter
openssoserver_protocol://openssoserver_host:port/openssoserver_deploy_uri/stsas the Security Token Service End Point. - Enter
openssoserver_protocol://openssoserver_host:port/openssoserver_deploy_uri/sts/mexas Security Token Service MEX End Point. - Save the changes.
- Click Back to Main Page.
Configure the WSP Agent Profile
- Under the Agents tab, click Web Service Provider.
- OPTIONAL: Click New to create the WSP agent profile if you do not see the default
wspin the table.- Enter wsp as the name of the agent profile.
- Define values for any required fields.
- Click Save.
- Click
wspfrom the table to access the profile. - Select all Security Mechanism choices.
- Check Is Request Signature Verified.
- Check Preserve Security Headers in Message.
- Specify
http://wsp-host-name:portnumber/StockService/StockServiceas the Web Service End Point. - Save the changes.
- Click Back to Main Page.
Review the Agent Authenticator Profile
- Under the Agents tab, click Agent Authenticator.
- Click
agentAuth. - Confirm that
wsp,wsc, andSecurityTokenServicehave been added to the Selected list under the Agent Profiles allowed to Read attribute.
If not, add them into the list and save the changes. - Log out of the OpenSSO console.
Testing the Sample
- Access the stock quote client page at
http://wsc-host-name:portnumber/StockQuoteClient/index.jsp.
The browser will be redirected to the OpenSSO Authentication Service. - Enter the user name and password of an existing OpenSSO user.
Upon successful authentication, the browser is redirected back to the Stock Quote Service. - Enter "JAVA" (or any other stock symbol) and click Get Quote.
Stock quote information for the entered symbol is displayed.
Posted at 10:57AM Jul 16, 2009 by Michael Teger in Sun | Comments[2]
