Note that there are some explanatory texts on larger screens.

plurals
  1. POCan Spring security be made to work for JSF navigations?
    primarykey
    data
    text
    <p>My problem is very similar to this existing SO post:<br> <a href="https://stackoverflow.com/questions/9177104/jsf-spring-security-integration-issue">JSF - Spring Security Integration issue</a></p> <p>Ravi's response regarding disabling once-per-request and specifying FORWARD to "get it to work" is echo'd other places on the web, namely:<br> <a href="http://www.coderanch.com/t/61490/oa/Spring-security-intercept-url" rel="nofollow noreferrer">http://www.coderanch.com/t/61490/oa/Spring-security-intercept-url</a><br> and long ago:<br> <a href="http://forum.springsource.org/showthread.php?11025-lt-jsp-forward-gt-bypasses-Acegi" rel="nofollow noreferrer">http://forum.springsource.org/showthread.php?11025-lt-jsp-forward-gt-bypasses-Acegi</a></p> <p>However, I'm just not able to get this to work. I've done both the items Ravi's response suggests:</p> <p>1) put once-per-request in spring's config: </p> <pre><code>&lt;http auto-config="true" use-expressions="true" once-per-request="false"&gt; &lt;intercept-url pattern="/partners/**" access="ROLE_PARTNER" /&gt; . . . &lt;/http&gt; </code></pre> <p>2) include FORWARD:</p> <pre><code>&lt;filter-mapping&gt; &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt; &lt;url-pattern&gt;/*&lt;/url-pattern&gt; &lt;dispatcher&gt;REQUEST&lt;/dispatcher&gt; &lt;dispatcher&gt;FORWARD&lt;/dispatcher&gt; &lt;/filter-mapping&gt; </code></pre> <p>In my case, I've got a command link into the partners section of my application that works (but shouldn't). It <em>is</em> true that every link after this first one and any searches posted do NOT work. But the initial navigation into /parterns/** does work, and I don't think it should. </p> <pre><code>&lt;p:menuitem&gt; &lt;h:commandLink ajax="false" action="/partners/search/partnerSearch" styleClass="ui-menuitem-link ui-corner-all"&gt; &lt;h:outputText value="Partners"/&gt; &lt;/h:commandLink&gt; &lt;/p:menuitem&gt; </code></pre> <p>I'm assuming this means that JSF doesn't actually use a request dispatcher forward to "forward" to the navigation outcome (and thus, Spring never gets a chance to re-evaluate the security). I've tried placing breakpoints and looking for myself, but it's slightly beyond my understanding what I'm seeing. </p> <p>I'm aware that I can use a redirect (but like the first SO post I linked to, don't want to do this). I'm also aware that I can put <code>&lt;sec:ifAnyGranted roles="ROLE_PARTNER"&gt;</code> around the menu item to prevent the click in the first place. </p> <p>I'm actually just curious as to why this doesn't work at all, when a few sources seem to indicate it should. </p> <p>My experience of it not working, is echo'd at least one other place:<br> <a href="http://forum.springsource.org/showthread.php?82900-FilterSecurityInterceptor-not-being-called-for-a-JSF-forward" rel="nofollow noreferrer">http://forum.springsource.org/showthread.php?82900-FilterSecurityInterceptor-not-being-called-for-a-JSF-forward</a></p> <p>My stuff is: </p> <pre><code>&lt;spring.version&gt;3.1.3.RELEASE&lt;/spring.version&gt; &lt;jsf.version&gt;2.1.23&lt;/jsf.version&gt; (mojarra) &lt;primeFaces.version&gt;3.5.9&lt;/primeFaces.version&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload