The Apache CXF
Fediz Identity Provider (IdP) has had the ability to talk to third party IdPs using SAML SSO since the 1.2.0 release. However, one of the
new features of the 1.3.0 release is the ability to configure the Fediz IdP to use the SAML SSO protocol directly, instead of WS-Federation. This means that Fediz can be used as a fully functioning SAML SSO IdP.
I added a new test-case to github to show how this works:
- cxf-fediz-saml-sso: This project shows how to use the SAML SSO interceptors of Apache CXF to
authenticate and authorize clients of a JAX-RS service.
The test-case consists of two modules. The first is a web application which contains a simple JAX-RS
service, which has a
single GET method to return a doubled number. The method is secured with
a @RolesAllowed annotation, meaning that only a user in roles "User", "Admin",
or "Manager" can access the service. The service is
configured with the SamlRedirectBindingFilter, which redirects unauthenticated users to a SAML SSO IdP for authentication (in this case Fediz). The service configuration also defines an AssertionConsumerService which validates the response from the IdP, and sets up the session for the user + populates the CXF security context with the roles from the SAML Assertion.
The second module deploys the Fediz IdP and STS in Apache Tomcat, as well as the "double-it" war above. It uses Htmlunit to make an invocation on the service and check that access is granted to the service. Alternatively, you can comment the
@Ignore annotation of the "testInBrowser" method, and copy the printed out
URL into a browser to test the service directly (user credentials:
"alice/ecila").
The IdP configuration is defined in
entities-realma.xml. Note that under "supportedProtocols" for the "idp-realmA" configuration is the value "urn:oasis:names:tc:SAML:2.0:profiles:SSO:browser". In addition, the default authentication URI is "
saml/up". These are the only changes that are required to switch the IdP for "realm A" from WS-Federation to SAML SSO.
No comments:
Post a Comment