|
By Mike Hortobagyi, with contributions from Marina Sum, February 13, 2009
|
|
|
|
Part 1 of this series introduces OpenSSO's virtual-federation capability and its Secure Attributes Exchange (SAE) component. Here in Part 2, you learn how to configure OpenSSO to federate applications, using those features.
|
OpenSSO is a Sun-sponsored, open-source project that offers core identity capabilities, including security for Web applications, single sign-on (SSO), federation, and identity services. Based on Sun Java System Access Manager, the project is the foundation for Sun OpenSSO Enterprise 8, the commercial release. In addition to working with enterprise-focused standards like SAML 2.0, XACML, and WS-Federation, OpenSSO works with community-based subproject protocols like OpenID and Information Cards.
|
|
|
Process
This article describes end-to-end virtual federation between an identity provider (IdP) application and a service provider (SP) application. However, for real-world deployments, you might choose to configure only one side of the virtual federation (either the IdP side or SP side only). For example, if only the IdP side is set up, the IdP application identity attributes will continue to be sent across to a Security Assertion Markup Language (SAML) 2.0-compliant product on the other end. (The IdP OpenSSO instance sends plain SAML 2.0 "on the wire.") Similarly, an SP-side only deployment is capable of transferring attributes from any SAML 2.0-compliant IdP product to an SP application, by means of the SP-side OpenSSO instance processing the SAML 2.0 assertion.
Figure 1 illustrates how virtual federation and SAE work. For brevity, this example assumes that OpenSSO is running at both the IdP and SP sides, and that SAE is used on either side. The packaged SAE Demo application included with OpenSSO is used as an example.
Figure 1: Process of Virtual Federation and SAE (Click image for larger view.) |
The process goes as follows:
- A user authenticates to the identity provider's (IdP's) application.
Note: Even though OpenSSO can authenticate users, many legacy applications have their
own authentication mechanism. To efficiently federate, loosely couple a legacy
application with OpenSSO by retaining the former's authentication mechanism and
adopting OpenSSO's federation capabilities.
- The authenticated user accesses the IdP's application and clicks a link that points to a
service provided by another application in a different domain.
- Through Secure Attribute Exchange (SAE), the IdP's application assembles the
appropriate user attributes (authentication and user data), encodes and signs it with
OpenSSO's lightweight virtual-federation library, and posts the now secure attributes to
the IdP's local OpenSSO instance.
- The IdP's local OpenSSO instance verifies the authenticity of the encoded attributes.
- The IdP's local OpenSSO instance initiates the appropriate SAML 2.0 SSO protocol and sends the attributes to the SP. The dispatch is part of the SAML assertion, with only plain SAML 2.0 "on the wire."
Note: To use SAE, however, you must use OpenSSO.
- The SP's local OpenSSO instance signs and encodes the attributes with SAE and sends
them to the SP's application.
- The SP's application verifies and decodes the attributes.
- The SP's application serves the user according to the attributes received.
Note: The SP end of the process need not involve SAE. Since the attributes are carried in a
SAML assertion, the SP can invoke the requested application through another means, such as
an OpenSSO Fedlet. However, SAE is highly recommendable because it seamlessly secures
the last-mile transfer of user attributes from the SP's OpenSSO instance to the SP's
application.
Configuring OpenSSO for Virtual Federation
This section describes how to configure OpenSSO for virtual federation, using the out-of-the-box SAE sample application.
Note: Some of the steps mention the URL protocol://hostname:portnumber/contextroot, where:
- protocol is either
http or https.
- hostname is the fully qualified domain name (FQDN) of the server. Important: Do not specify a numeric IP address or
localhost.
- portnumber is the number of the port on which the Web container is listening.
- contextroot is the location in which you deployed the
OpenSSO.war file in the Web container.
The host names, port numbers, and context roots in the procedures are examples only. Replace them with the real-life names in your environment.
Setting Up Two OpenSSO Instances
First, set up two OpenSSO instances by deploying the OpenSSO.war file and running the Configurator for each of them:
- The first instance, the IdP
www.idp.com, is at http://www.idp.com:8888/opensso/.
- The second instance, the SP
www.sp.com, is at http://www.sp.com:7777/opensso/.
Configuring the IdP Instance (Signing, Entities, and Circle of Trust)
Next, follow these steps to configure the IdP instance:
- Log in to the OpenSSO Administration Console at
http://www.idp.com:8888/opensso/UI/Login as amAdmin with the corresponding password you specified while configuring OpenSSO.
Note: Typical real-world deployments are Secure Sockets Layer (SSL)-enabled HTTPS applications. However, for this example, SSL has not been enabled.
The Administration Console is displayed. See Figure 2.
Figure 2: OpenSSO Administration Console (Click image for larger view.) |
- Click Create Hosted Identity Provider under Create SAMLv2 Providers.
The "Create a SAMLv2 Identity Provider on this Server" screen is displayed.
- Under Signing Key, choose test from the drop-down menu.
To enforce SAML 2.0 SSO with the browser-based POST profile, you must enable assertion signing by means of a signing key.
- Under Circle of Trust, type
mycot or a COT name of your choice in the New Circle of Trust text field. Click Configure at the top-right corner. See Figure 3.
Figure 3: "Create a SAMLv2 Identity Provider on this Server" Screen (Click image for larger view.) |
OpenSSO displays the message: Your Identity Provider has been configured.
- Click Finish.
Configuring the SP Instance (Entities and Circle of Trust)
Now configure the SP instance:
- Log in to the OpenSSO Administration Console at
http://www.sp.com:7777/opensso/task/Home as amAdmin.
- Click Create Hosted Service Provider under Create SAMLv2 Providers.
- Under Signing Key, choose test from the drop-down menu.
- Under Circle of Trust, type
mycot or a COT name of your choice in the New Circle of Trust field. Click Configure at the top-right corner. See Figure 4.
Figure 4: "Create a SAMLv2 Service Provider on this Server" Screen (Click image for larger view.) |
OpenSSO displays the message: Service provider is configured. You can modify the provider's profile under the Federation tab. Do you want to create a remote identity provider?
- Click Yes.
The Create a SAMLv2 Remote Identity Provider screen is displayed.
- In the "URL where metadata is located" text field, type protocol
://FQDN:portnumber/contextroot/saml2/jsp/exportmetadata.jsp as your IdP instance. An example is http://www.idp.com:8888/opensso/saml2/jsp/exportmetadata.jsp.
- Click Configure at the top-right corner. See Figure 5.
Figure 5: "Create a SAMLv2 Service Provider on this Server" Screen (Click image for larger view.) |
OpenSSO displays the message: Identity provider is configured. You can modify the provider's profile under the Federation tab.
- Click OK.
To double-check that the settings are correct, click the Federation tab and verify that mycot is under Circle of Trust and that the two entitieshttp://www.idp.com:8888/opensso and http://www.sp.com:7777/openssoare under Entity Providers.
Configuring the IdP Instance (Remote SP)
Complete the configuration process for the IdP:
- In the OpenSSO Administration Console, click Register Remote Service Provider under Create SAMLv2 Providers.
- In the "URL where metadata is located" text field, type protocol
://FQDN:portnumber/contextroot/saml2/jsp/exportmetadata.jsp as your SP instance. An example is http://www.sp.com:7777/opensso/saml2/jsp/exportmetadata.jsp.
- Click Configure at the top-right corner. See Figure 6.
Figure 6: Create a SAMLv2 Remote Service Provider Screen (Click image for larger view.) |
OpenSSO displays the message: Service provider is configured. You can modify the provider's profile under the Federation tab.
- Click OK.
To double-check that the settings are correct, click the Federation tab and verify that mycot is under Circle of Trust and that the two entitiesthe URLs to your IdP and SP instances in the form of protocol://FQDN:portnumber/contextrootare under Entity Providers.
Configuring the IdP for Virtual Federation
This section shows you how to configure the IdP for virtual federation.
Setting the Realm Attributes
- Log in to the OpenSSO Administration Console at
http://www.idp.com:8888/opensso/UI/Login as amAdmin.
- Set the Ignore Profile service attribute:
- Click the Access Control tab.
- Under Realms, click / (Top Level Realm) and then click the Authentication tab, followed by Advanced Properties.
The Core screen for Realm Attributes is displayed.
- Under User Profile, select Ignored.
- Click Save at the top right corner. See Figure 7.
Figure 7: Core Screen for Realm Attributes (Click image for larger view.) |
- Click Back to Authentication.
- Click Back to Access Control.
- Click the Federation tab. Under Entity Providers, click the
http://www.idp.com:8888/opensso entity.
- Click the Assertion Processing tab.
- Under Attribute Mapper, type
mail=mail in the New Value text field. Click Add.
- Repeat steps 4 and 5 with
branch=branch for the New Value text field. Click Save.
Generating the Encoded Password on the IdP
- Open a new browser window and go to
http://www.idp.com:8888/opensso/encode.jsp.
Troubleshooting tip: If you see a No permission error message, it's likely because of
a bug in encode.jsp. Log out and log back in as amadmin (all lowercase this time).
- Type
my-idp-secret in the "Enter the password to encode" text field. Click Encode.
See Figure 8.
Figure 8: Screen for Password to Encode (Click image for larger view.) |
OpenSSO displays the encoded password.
- Copy the password and save it for later use.
In our case, the password is AQICWa2eBPG0AIcwxGsZsf60Cp9x9eZmwn8h. The one you generate will be different.
Configuring SAE on the IdP
- Navigate back to the SAE Configuration tab of the IdP by clicking the Federation tab, followed by
www.idp.com and Advanced.
- Verify that the IdP URL reads
http://www.idp.com:8888/opensso/idpsaehandler/metaAlias/idp.
- Under Per Application Security Configuration, type the following string in the New Value text field and then click Add:
url=http://www.idp.com:8888/opensso/samples/saml2/sae/
saeIDPApp.jsp|type=symmetric|secret=AQICWa2eBPG0AIcwxGsZsf60Cp
9x9eZmwn8h
In this string, replace AQICWa2eBPG0AIcwxGsZsf60Cp9x9eZmwn8h with the encoded password you obtained in step 3 in the previous section. See Figure 9.
Figure 9: SAE Configuration Screen (Click image for larger view.) |
- Click Save and then click Back.
- Verify that you are still at the Federation tab. If not, click that tab.
- Under Entity Providers, click the
http://www.sp.com:7777/opensso entity.
- In the Request/Response Signing section under Signing and Encryption, verify that
Authentication Requests Signed and Assertions Signed are selected. See Figure 10.
Figure 10: Signing and Encryption Screen for the SP (Click image for larger view.) |
- Click Save at the top-right corner.
Specifying the SP's OpenSSO Service Endpoint
- Click the Advanced tab.
- Under SAE Configuration, do the following:
- Type
http://www.sp.com:7777/opensso/spsaehandler/metaAlias/sp in the SP URL text field.
The URL points to an SP's OpenSSO service endpoint that can process virtual federation requests.
- Type
http://www.sp.com:7777/opensso/samples/saml2/sae/saeSPApp.jsp in the SP Logout URL text field. Click Save. See Figure 11.
Figure 11: SAE Configuration Screen for the IdP (Click image for larger view.) |
- Log out of the OpenSSO Administration Console.
Configuring the SP for Virtual Federation
This section shows you how to configure the SP for virtual federation.
Setting the Realm Attributes
- Log in to the OpenSSO Administration Console at
http://www.sp.com:7777/opensso/UI/Login as amAdmin.
- Set the Ignore Profile service attribute:
- Click the Access Control tab.
- Under Realms, click / (Top Level Realm) and then click the Authentication tab, followed by Advanced Properties.
The Core screen for Realm Attributes is displayed.
- Under User Profile, select Ignored.
- Click Save at the top-right corner. See Figure 7.
- Click Back to Authentication.
- Click Back to Access Control.
- Click the Federation tab. Under Entity Providers, click the
http://www.sp.com:7777/opensso entity.
- In the Request/Response Signing section under Signing and Encryption, verify that Authentication Requests Signed and Assertions Signed are selected. Click Save.
- Click the Assertion Processing tab.
- Under Attribute Mapper, type
mail=mail in the New Value text field. Click Add.
- Repeat steps 5 and 6 with
branch=branch for the New Value text field.
- Under Auto Federation, select Enabled and type
mail in the Attribute text field. Click Save. See Figure 12.
Figure 12: Attribute Mapper Screen (Click image for larger view.) |
Generating the Encoded Password on the SP
- Open a new browser window and go to
http://www.sp.com:7777/opensso/encode.jsp.
- Type
my-sp-secret in the "Enter the password to encode" text field. Click Encode. See Figure 8.
OpenSSO displays the encoded password.
- Copy the encoded password and save it for later use.
In our case, that password is AQICiEMNe+8E+OsDOH2/eihQa1dWgvn5vstV. The one you generate will be different.
Configuring SAE on the SP
- Navigate back to the SAE Configuration tab of the IdP by clicking the Federation tab, followed by
www.sp.com and Advanced.
- Verify that the SP URL reads
http://www.sp.com:7777/opensso/spsaehandler/metaAlias/sp.
- Type
http://www.sp.com:7777/opensso/samples/saml2/sae/saeSPApp.jsp in the SP Logout URL text field.
- Under Per Application Security Configuration, type the following string in the New Value text field and then click Add:
url=http://www.sp.com:7777/opensso/samples/saml2/sae/
saeSPApp.jsp|type=symmetric|secret=AQICiEMNe+8E+OsDOH2/
eihQa1dWgvn5vstV
In this string, replace AQICiEMNe+8E+OsDOH2/eihQa1dWgvn5vstV with the encoded password you obtained in step 3 in the previous section. See Figure 13.
Figure 13: SAE Configuration Screen for the SP (Click image for larger view.) |
- Click Save and log out of the OpenSSO Administration Console.
Modifying the OpenSSO Application's Shared Secret on the SP
Now modify the OpenSSO application's shared secret on the SP. Later, you'll test the virtual federation-SAE configuration with the SAE sample application in OpenSSO.
To change the secret shared between the SP's OpenSSO instance with the SP application (in this case, saeSPApp.jsp), do the following:
- On the SP instance, edit the file at deployed-WAR-file-dir
/opensso/samples/saml2/sae/saeSPApp.jsp.
- Change line 62 from
String secret = "secret12"; to String secret = "my-sp-secret";
- Save the file.
- Restart the application container.
Note: In real-world deployments, be sure to secure and protect the shared secret. For example, store that string in a secured or encrypted text file, or retrieve it from a database on the fly.
For the purposes of the bundled sample, you need not perform the preceding procedure on the IdP's application (saeIDPApp.jsp) because you input the shared secret directly on the Web form.
Testing Virtual Federation With OpenSSO's SAE Sample
To test virtual federation with OpenSSO's SAE sample application:
- Close all your browser instances.
- Open a new browser, clear the cookies, and go to
http://www.idp.com:8888/opensso/samples/saml2/sae/saeIDPApp.jsp.
- Configure the form settings:
- Type
http://www.sp.com:7777/opensso/samples/saml2/sae/saeSPApp.jsp in the SP App URL text field.
- Type
http://www.idp.com:8888/opensso/idpsaehandler/metaAlias/idp in the "SAE URL on IDP end" text field.
The URL must be in the form of protocol://FQDN:portnumber/contextroot/idpsaehandler/metaAlias/idp for your IdP instance.
- Verify that the "This application's identity" text field reflects the correct URL:
http://www.idp.com:8888/opensso/samples/saml2/sae/saeIDPApp.jsp.
The URL must be in the form of protocol://FQDN:portnumber/contextroot/samples/saml2/sae/saeIDPApp.jsp for your IdP instance.
- Choose symmetric from the Crypto Type drop-down menu.
- Type
my-idp-secret in the Shared Secret/Private Key Alias text field.
- Deselect the "Use Cached SecureAttrs" instance. See Figure 14.
Figure 14: Settings for the SAE Sample Application (Click image for larger view.) |
- Click Generate URL.
OpenSSO confirms the settings. See Figure 15.
Figure 15: Confirmation of Settings for the SAE Sample Application (Click image for larger view.) |
- Click ssourl.
- Verify that your browser URL now reads
http://www.sp.com:7777/opensso/samples/saml2/sae/saeSPApp.jsp and that the attributes (Secure Attrs) for the SAE sample are listed, as shown in Figure 16.
Figure 16: Attributes in the SAE Sample Application (Click image for larger view.) |
- Optional. To capture and view the resulting SAML assertion, increase the logging level:
- Log in to the SP instance as
amAdmin.
- Click Configuration, followed by System and Logging.
- Under Logging Level, select the radio box FINE and click Save.
- Repeat steps 1-6 to run the SAE demo application again.
The log file in question is called SAML.access in the OpenSSO-installation-dir/opensso/log directory. In the body of the SAML assertion are the SAE attributes
passed from the IdP to the SP. See this example:
<saml:AttributeStatement>
<saml:Attribute Name=""branch"">
<saml:AttributeValue
xmlns:xs=""http://www.w3.org/2001/XMLSchema""
xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""
xsi:type=""xs:string"">mainbranch</saml:AttributeValue>
</saml:Attribute>
<saml:Attribute Name=""mail"">
<saml:AttributeValue
xmlns:xs=""http://www.w3.org/2001/XMLSchema""
xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""
xsi:type=""xs:string"">testuser@foo.com</saml:AttributeValue>
</saml:Attribute>
</saml:AttributeStatement>
|
Setting the Advanced Configurations
This section describes advanced configurations.
Configuring the IdP to Use the SAML 2 Browser POST Profile
To configure the IdP so that it uses the SAML 2 browser POST profile:
- On the IdP instance, edit the file deployed-WAR-file-dir
/opensso/saml2/jsp/SA_IDP.jsp.
- Change line 465 from
+ "&" + SAML2Constants.BINDING + "=" + SAML2Constants.HTTP_ARTIFACT
to
+ "&" + SAML2Constants.BINDING + "=" + SAML2Constants.HTTP_POST
The boldfaced string denotes the original and the revised code.
- Save the file.
- Restart the application container.
- Run the tests in the section Testing Virtual Federation With OpenSSO's SAE Sample again to validate federation with the browser's
POST profile.
Extending the SAE Sample Patterns to Your Own Applications
The bundled SAE sample is a good way to verify that you have correctly configured the IdP
and SP instances for virtual federation and SAE. However, realization of the true benefits of
those capabilities mandates some form of integration with the legacy application to be
federated. Integration requires only one step: Simply include the OpenSSO client SDK and
import any required classes, such as com.sun.identity.sae.api.SecureAttrs and
com.sun.identity.sae.api.Utils. From there, you can code the SAE validation
and encode/decode logic right into your federated application!
To customize the IdP:
- Follow the code in the
saeIDPApp.jsp file at deployed-WAR-file-dir/opensso/samples/saml2/sae to package the additional attributes to be secured.
- Post to OpenSSO's SAE service URL.
To customize the SP, follow the code in the saeSPApp.jsp file, also at deployed-WAR-filedir/opensso/samples/saml2/sae. That code explains how to retrieve and unpack the
secure attributes handed off from OpenSSO after it has validated and consumed the SAML 2
assertion.
Conclusion
OpenSSO's virtual federation capability delivers the ability to federate applications to
multiple providers using SAML 2.0 and a single OpenSSO instance. Not only does virtual
federation ease first-mile and last-mile integration efforts, it also does so securely with the
use of secure attributes exchange. OpenSSO Build 6 will additionally provide encryption support for virtual federation attributes.
References
- Sun OpenSSO Enterprise
- Related articles
- Sun developer services
We welcome your participation in our community. Please keep your comments civil and on point. You can optionally provide your email address to be notified of repliesyour information is not used for any other purpose. By submitting a comment, you agree to these Terms of Use.
|
Mike Hortobagyi is a solutions architect with Brighton Consulting, a Sun channel partner in Canada. As a certified information systems security professional (CISSP), Mike specializes in identity and access management in the financial services industry.
|
Marina Sum, having been a writer for Sun since 1989 and a staff writer for
Sun Developer Network for several years, plans to
continue to blog now and then on
Sun-sponsored open-source projects. See her blog for her farewell.
|
|