-
1. Re: s:actionLink and JAAS
lcoetzee Apr 2, 2006 4:25 AM (in response to lcoetzee)I have added a jira feature request for extending the actionLink component.
http://jira.jboss.com/jira/browse/JBSEAM-191 -
2. Re: s:actionLink and JAAS
gavin.king Apr 3, 2006 5:14 AM (in response to lcoetzee)Note one thing about <s:link> (I renamed it yesterday): it does NOT do form submissions. It is purely for things like search screens and master-detail views. What it *does* support is:
Calling Actions:<s:link action="#{my.actionMethod}"/>
Or Navigation Rules:<s:link action="success"/>
Linking to a view by JSF view id:<s:link view="/myView.xhtml"/>
Both at Once:<s:link action="#{before.myView}" view="/myView.xhtml"/>
Specifying the conversation propagation type:<s:link action="#{childEditor.selectChild}" propagation="nest"/>
<s:link action="#{childEditor.selectChild}" propagation="begin"/>
<s:link action="#{childEditor.selectChild}" propagation="end"/>
<s:link action="#{childEditor.selectChild}" propagation="join"/>
<s:link action="#{childEditor.selectChild}" propagation="none"/>
Finally, if you use <s:link> inside a <h:dataTable> that is pointed to a @DataModel, the @DataModelSelection is populated.
---
I don't see how it is helpful to have <s:link> support the JAAS stuff if other stuff like <h:commandLink> and <h:inputText> do not ... or are you assuming that users will be using this stuff together with a library like tomahawk that *does* support it? -
3. Re: s:actionLink and JAAS
lcoetzee Apr 3, 2006 5:43 AM (in response to lcoetzee)I don't see how it is helpful to have <s:link> support the JAAS stuff if other stuff like <h:commandLink> and <h:inputText> do not ... or are you assuming that users will be using this stuff together with a library like tomahawk that *does* support it?
For my specific environment it would be helpful as I use the tomahawk components combined with JAAS quite a lot (most of the tomahawk stuff just seems to add user role support). I don't know how much JAAS itself is really used which might just over complicate stuff on the Seam side. I am sure I can play around with the rendered attribute based on user's roles that I expose to achieve the same effect.
As an aside: to use the ui stuff with the latest myfaces snapshot one has to change the imports in HTML.java (seems the myfaces guys have moved things around a bit). Also replace the myfaces-api.jar and myfaces-impl.jar in seam-src/lib with myfaces-api-1.1.3-SNAPSHOT.jar and
myfaces-impl-1.1.3-SNAPSHOT.jar
org.jboss.seam.ui.HTML.java//import org.apache.myfaces.renderkit.RendererUtils; //this for myfaces snapshot 1.1.3 import org.apache.myfaces.shared_impl.renderkit.RendererUtils; //import org.apache.myfaces.util.ArrayUtils; //this for myfaces snapshot 1.1.3 import org.apache.myfaces.shared_impl.util.ArrayUtils;
Regards
Louis -
4. Re: s:actionLink and JAAS
gavin.king Apr 3, 2006 6:07 AM (in response to lcoetzee)For my specific environment it would be helpful as I use the tomahawk components combined with JAAS quite a lot
It would be better if there was a more generic solution.
I wonder if it is possible to create an <s:secure> tag and then do, eg:<s:secure role="Admin"> <h:commandLink ... /> </s:secure>
I have not yet investigated whether stuff like this is easy in JSF.I am sure I can play around with the rendered attribute based on user's roles that I expose to achieve the same effect
The problem I see here is that you need a way to pass the name of the role you need, and JSF-EL does not support parameters (this is silly, btw).
I guess you could use:<s:link rendered="#{not empty user.roles['Admin']}"/>
or something. But that is kinda ugly.to use the ui stuff with the latest myfaces snapshot one has to change the imports in HTML.java
Eeeek! Very careless of me, I was NOT supposed to have a MyFaces dependency there! Fixed in CVS. -
5. Re: s:actionLink and JAAS
lcoetzee Apr 3, 2006 6:33 AM (in response to lcoetzee)The problem I see here is that you need a way to pass the name of the role you need, and JSF-EL does not support parameters (this is silly, btw).
Agreed. What I have done to simulate the JAAS roles stuff is expose stuff in my PortalUser object (this required for each role that I have.. clumsy but works):@Transient public Boolean getServiceManager() { //userHasRole is a hashmap containing all the user roles return userHasRole(PortalRole.serviceManagerLiteral); }
in my view page I then do something like:<f:subview rendered="#{portalUser.serviceManager}"> <li><s:link action="#{serviceManagementBean.loadAllServices}" propagation="end" id="serviceManagement"> <h:outputText value="#{msgs.serviceManagement}" /> </s:link></li> </f:subview>
Fixed in CVS.
Excellent.
L -
6. Re: s:actionLink and JAAS
gavin.king Apr 3, 2006 6:46 AM (in response to lcoetzee)Yes, perhaps what we need is an <s:subview/>
-
7. Re: s:actionLink and JAAS
gavin.king Apr 3, 2006 9:33 AM (in response to lcoetzee)OK, actually, Jacob convinced me of something easier.
Now we have:<h:commandLink action="..." rendered="#{isUserInRole['Admin']}"/>
In CVS. Please test it and see if it works for you... -
8. Re: s:actionLink and JAAS
lcoetzee Apr 3, 2006 9:53 AM (in response to lcoetzee)Jip it works !
I did something like this below:<f:subview rendered="#{isUserInRole['ServiceManager']}"> <li><s:link action="#{serviceManagementBean.loadAllServices}" propagation="end" id="serviceManagement"> <h:outputText value="#{msgs.serviceManagement}" /> </s:link></li> </f:subview>
Great stuff. I love the speed at which things happen !
L -
9. Re: s:actionLink and JAAS
gavin.king Apr 3, 2006 9:55 AM (in response to lcoetzee)Didn't you have some other custom-written stuff for JAAS integration? Exactly what pieces are there, and do any of them make sense to belong in the Seam core?
-
10. Re: s:actionLink and JAAS
lcoetzee Apr 3, 2006 10:20 AM (in response to lcoetzee)If memory serves: 3 main parts regarding JAAS:
1. The user management, assignment or roles etc. which I assume would be application specific. However, associated with that is the need to flush the JAAS cache (which I haven't been able to get going in JBoss 4.0.x)
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=80155
2. The initialization of the user after the JAAS login (injection of PortalUser). I used a factory method to explicitely load the user as extracted from the user principalPrincipal principal = FacesContext.getCurrentInstance().getExternalContext().getUserPrincipal();
3. I also extended the ViewHandler to force the users locale and view options (as loaded from the database for that principal) to the correct values. The factory I used (in 2 above) didn't get initiated for the first showing of the admin pages. Again this will be application specific as not all implementations will have a choice regarding languages and view options. We are doing some weird things with CSS to provide larger fonts and different for and background colors
I think a combination of these three elements (if 3 is required is doubtful) would be good.
I can extract the appropriate pieces and place them somewhere to give you a better idea.
L -
11. Re: s:actionLink and JAAS
gavin.king Apr 3, 2006 10:28 AM (in response to lcoetzee)I think (2) would make sense, the others probably not.
At some stage, the various groups in JBoss (jBPM, AS, Seam, Portal) need to get together to develop and unified identity management solution that will plug in everywhere. But this is too big of a job to do today. -
12. Re: s:actionLink and JAAS
aahamlin Nov 9, 2006 11:20 AM (in response to lcoetzee)I hope I'm not missing something obvious, but I have been trying to piece together the steps to perform a JAAS login to a webapp and then instantiate my User entity bean and have it outjected into a Seam app.
I've found many breadcrumbs but many are 6 months to a year old... I recall seeing a post recently about the Seam CVS containing some JAAS examples that are not included in 1.0.1.GA. Of course, I can't find that post now. :(
I've search via google, the Jboss forums and Jboss wiki for "Seam JAAS login" but have not found a comprehensive guide to doing - what I think - should be a fairly common place function.
Could you point me to the location of such examples and documentation on Seam's current JAAS capabilities? -
13. Re: s:actionLink and JAAS
aahamlin Nov 9, 2006 12:02 PM (in response to lcoetzee)Hmm, may have answered my own question. I found the "post" I was referring to, having just realized that the forums page width caused the Next Page links to scroll off to the right - and I was too careless to notice, sorry.
The later pages appear to answer my question a bit more fully.
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=74300
Still I hope that the examples and documentation get all this info rolled into them at some point, so other don't need to search for far to find the answers.
BTW - the Fisheye and CVS views of the JbossSeam project don't seem to be working, so I couldn't follow up on what "examples" may be posted there.