Results 1 to 4 of 4

Thread: Spring Security Taglib for JSF does not work with Spring WebFlow 2.2.0?

  1. #1
    Join Date
    Sep 2009
    Posts
    17

    Default Spring Security Taglib for JSF does not work with Spring WebFlow 2.2.0?

    Hi everyone,

    i'm trying to use the Spring Security Taglib for JSF, therefore i upgraded to Webflow 2.2.0. Still, the tags are not parsed. It might well be a configuration error. I am certain that my user is authenticated, so spring security actually works fine. its just the taglibs....

    What am I doing wrong?

    Thanks in advance!

    simon

    xhtml
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <ui:composition xmlns="http://www.w3.org/1999/xhtml"
    				xmlns:ui="http://java.sun.com/jsf/facelets"
    				xmlns:h="http://java.sun.com/jsf/html"
    				xmlns:f="http://java.sun.com/jsf/core"
    				xmlns:c="http://java.sun.com/jstl/core"
    				xmlns:sf="http://www.springframework.org/tags/faces"
    				xmlns:a4j="http://richfaces.org/a4j"
    				xmlns:rich="http://richfaces.org/rich"
    				xmlns:sec="http://www.springframework.org/security/tags"
    				
    				template="/WEB-INF/layouts/default.xhtml">
    
    
    <ui:define name="content">
    	<sec:authorize ifAllGranted="ROLE_TEST">
    		<h:form id="cleanModulesForm">
    			<rich:panel>
     .....
    			</rich:panel>
    		</h:form>
    	</sec:authorize>
    ...
    springsecurity.taglib.xml
    Code:
    <?xml version="1.0"?>
    <!DOCTYPE facelet-taglib PUBLIC
      "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
      "http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
    <facelet-taglib>
    	<namespace>http://www.springframework.org/security/tags</namespace>
    	<tag>
    		<tag-name>authorize</tag-name>
    		<handler-class>org.springframework.faces.security.FaceletsAuthorizeTagHandler</handler-class>
    	</tag>
    	<function>
    		<function-name>areAllGranted</function-name>
    		<function-class>org.springframework.faces.security.FaceletsAuthorizeTagUtils</function-class>
    		<function-signature>boolean areAllGranted(java.lang.String)</function-signature>
    	</function>
    	<function>
    		<function-name>areAnyGranted</function-name>
    		<function-class>org.springframework.faces.security.FaceletsAuthorizeTagUtils</function-class>
    		<function-signature>boolean areAnyGranted(java.lang.String)</function-signature>
    	</function>
    	<function>
    		<function-name>areNotGranted</function-name>
    		<function-class>org.springframework.faces.security.FaceletsAuthorizeTagUtils</function-class>
    		<function-signature>boolean areNotGranted(java.lang.String)</function-signature>
    	</function>
    	<function>
    		<function-name>isAllowed</function-name>
    		<function-class>org.springframework.faces.security.FaceletsAuthorizeTagUtils</function-class>
    		<function-signature>boolean isAllowed(java.lang.String, java.lang.String)</function-signature>
    	</function>
    </facelet-taglib>

    web.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" 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">
    	<!-- Register the spring security facelets taglib (since webflow 2.2.0) -->
    	<context-param>
    	    <param-name>javax.faces.FACELETS_LIBRARIES</param-name>
    	    <param-value>/WEB-INF/springsecurity.taglib.xml</param-value>
    	</context-param>
    .....

  2. #2
    Join Date
    Aug 2006
    Location
    Brooklyn
    Posts
    556

    Default

    What's the error you're getting?

    Keep in mind there are JSF 2 and JSF 1.2 specific TagHandler versions. The documentation covers that. Based on your present configuration I would assume you're using JSF 2.

    You will find an example in this svn repository:

    https://src.springframework.org/svn/...faces-showcase

  3. #3
    Join Date
    Sep 2009
    Posts
    17

    Default

    that was the point... did a proper upgrade to jsf 2.0 now, only to recognize that richfaces do not support that till rel 4.0.X, which won't be available as final before february.
    so will stick with jsf 1.2 and the security facelets taglibs provided by dominik dorn.
    http://wwwdominikdorn.com/facelets/

    cheers,
    simon

  4. #4
    Join Date
    Aug 2006
    Location
    Brooklyn
    Posts
    556

    Default

    You *can* use the Spring Security facelets tag library with JSF 1.2.

    For JSF 1.2 use the same content in the springsecurity.taglib.xml but replace FaceletsAuthorizeTagHandler with Jsf12FaceletsAuthorizeTagHandler and FaceletsAuthorizeTagUtils wiht Jsf12FaceletsAuthorizeTagUtils.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •