14.5.13.2. IDP Configuration
For an IDP web application to be SAML enabled on any Servlet Container, you will have to add listeners and servlets as shown in the web.xml below:
Part of the idp-standalone.war
Example 14.15. web.xml
<?xml version="1.0" encoding="ISO-8859-1"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> <display-name>Standalone IDP</display-name> <description> IDP Standalone Application </description> <!-- Listeners --> <listener> <listener-class>org.picketlink.identity.federation.web.core.IdentityServer</listener-class> </listener> <!-- Create the servlet --> <servlet> <servlet-name>IDPLoginServlet</servlet-name> <servlet-class>org.picketlink.identity.federation.web.servlets.IDPLoginServlet</servlet-class> </servlet> <servlet> <servlet-name>IDPServlet</servlet-name> <servlet-class>org.picketlink.identity.federation.web.servlets.IDPServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>IDPLoginServlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>IDPServlet</servlet-name> <url-pattern>/IDPServlet</url-pattern> </servlet-mapping> </web-app>
A jsp for login would be:
Example 14.16. jsp/login.jsp
<html><head><title>Login Page</title></head> <body> <font size='5' color='blue'>Please Login</font><hr> <form action='<%=application.getContextPath()%>/' method='post'> <table> <tr><td>Name:</td> <td><input type='text' name='JBID_USERNAME'></td></tr> <tr><td>Password:</td> <td><input type='password' name='JBID_PASSWORD' size='8'></td> </tr> </table> <br> <input type='submit' value='login'> </form></body> </html>
The jsp for error would be:
Example 14.17. jsp/error.jsp
<html> <head> <title>Error!</title></head> <body> <font size='4' color='red'> The username and password you supplied are not valid. </p> Click <a href='<%= response.encodeURL("login.jsp") %>'>here</a> to retry login </body> </form> </html>