Added by Sebastian Gonzalez Oyuela, last edited by Sebastian Gonzalez Oyuela on Jan 12, 2009
()
Labels:
Introduction
This is a quick start for integrating a JBoss application with JOSSO.
Prerequisites
- JOSSO Gateway configured and running (in any platform).
- JOSSO Agent configured in the selected platform.
- A Java Web/EJB Application.
Web Applications
1. Create the weblogic.xml descriptor
In your web application, create the weblogic.xml descriptor in the WEB-INF folder and map all the roles your application will use.
weblogic.xml
<?xml version="1.0" encoding="UTF-8"?> <weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90" xmlns:j2ee="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd"> <security-role-assignment> <role-name>role1</role-name> <principal-name>role1</principal-name> </security-role-assignment> </weblogic-web-app>
2. Add the wls-login-redirect.jsp page
Copy the wls-login-redirect.jsp page provided by josso to your application resources directory.
login-redirect.jsp
<%@page contentType="text/html; charset=iso-8859-1" language="java" session="true" %> <% response.sendRedirect(request.getContextPath() + "/josso-wls/josso_login.jsp"); %>
3. Configure the <login-config> section in the web.xml descriptor
Use the following login configuration for the web application
web.xml
...
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/wls-login-redirect.jsp</form-login-page>
<form-error-page>/wls-login-redirect.jsp</form-error-page>
</form-login-config>
</login-config>
...
4. Configure JOSSO Servlet Filters
web.xml (Weblogic 10.0)
...
<!-- Uncomment if you need identity in public resources
<filter>
<filter-name>WLAuthenticatorProviderFilter</filter-name>
<description>Weblogic 10.0 Authenticator Provider Serlvet Filter</description>
<filter-class>org.josso.wls10.agent.WLSAgentServletFilter</filter-class>
</filter>
-->
<!-- Comment if you need identity in public resources -->
<filter>
<filter-name>WLSessionEnforcementServletFilter</filter-name>
<description>WebLogic 10.0 Session Enforcement Servlet Filter</description>
<filter-class>org.josso.wls10.agent.WLSSessionEnforcementServletFilter</filter-class>
</filter>
...
<!--
<filter-mapping>
<filter-name>WLAuthenticatorProviderFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
-->
<filter-mapping>
<filter-name>WLSessionEnforcementServletFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
...
web.xml (Weblogic 9.2)
...
<!-- Uncomment if you need identity in public resources
<filter>
<filter-name>WLAuthenticatorProviderFilter</filter-name>
<description>Weblogic 9.2 Authenticator Provider Serlvet Filter</description>
<filter-class>org.josso.wls92.agent.WLSAgentServletFilter</filter-class>
</filter>
-->
<!-- Comment if you need identity in public resources -->
<filter>
<filter-name>WLSessionEnforcementServletFilter</filter-name>
<description>WebLogic 9.2 Session Enforcement Servlet Filter</description>
<filter-class>org.josso.wls92.agent.WLSSessionEnforcementServletFilter</filter-class>
</filter>
...
<!--
<filter-mapping>
<filter-name>WLAuthenticatorProviderFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
-->
<filter-mapping>
<filter-name>WLSessionEnforcementServletFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
...
5. Copy additional resources
Create a josso-wls folder in your application resources directory and copy the following files :
- josso_login.jsp
- josso_logout.jsp
- josso_security_check.jsp
You can find this files here
The three of them contain the same jsp script :
<%response.sendError(javax.servlet.http.HttpServletResponse.SC_NOT_FOUND);%>
EJB applications
1. Create the weblogic-ejb-jar.xml descriptor
Add all the security role assignments your application needs.
jboss.xml
<?xml version="1.0" encoding="ISO-8859-1"?> <weblogic-ejb-jar xmlns="http://www.bea.com/ns/weblogic/90" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-ejb-jar.xsd"> <weblogic-enterprise-bean> ... </weblogic-enterprise-bean> <security-role-assignment> <role-name>role1</role-name> <principal-name>role1</principal-name> </security-role-assignment> </weblogic-ejb-jar>