-
15. Re: JAAS and SEAM
lcoetzee Feb 23, 2006 1:09 AM (in response to armita)I have incorporated the whole JAAS thing for the web container (using the databaseserverloginmodule ... postgresql) in my project. Unfortunately not on the EJB layer.
I think it would be good to share! What will be the best way ? I can cut the project down to just have a basic Seam app with JAAS for authentication. Maybe upload the complete project somwhere (would be painful in the forum as it contains a lot of diffent configuration files).
Suggestions ?
Louis -
16. Re: JAAS and SEAM
theute Feb 23, 2006 3:49 AM (in response to armita)You can use the Wiki pages for that, you can attach files to a Wiki page.
Create a new page and link it from here: http://www.jboss.com/wiki/Wiki.jsp?page=JBossSeam -
17. Re: JAAS and SEAM
js8523 Feb 23, 2006 3:54 AM (in response to armita)It would be really cool if you placed it in the jboss seam wiki.
Thanks,
James -
18. Re: JAAS and SEAM
lcoetzee Feb 23, 2006 6:17 AM (in response to armita)Wiki ... will do so. Probably only over the weekend though (too many meetings today and tomorrow).
L -
19. Re: JAAS and SEAM
lcoetzee Feb 26, 2006 11:45 AM (in response to armita)I have uploaded a stripped down Seam example using JAAS with postgresql.
See JAASExample.zip
http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossSeam
Regards
Louis -
20. Re: JAAS and SEAM
paper Mar 1, 2006 9:16 AM (in response to armita)for anybody who is looking for sunfires logininterceptor-solution:
getEJBContext() doesn't work anymore
->
http://www.jboss.org/index.html?module=bb&op=viewtopic&t=77225
Greets
Dennis -
-
22. Re: JAAS and SEAM
mirko27 Mar 18, 2006 11:41 AM (in response to armita)My question. If i have created user Entity does JAAS automatically load user entity to session scope? JAASExample seems to do nothing for this behaviour.
-
23. Re: JAAS and SEAM
mirko27 Mar 18, 2006 6:07 PM (in response to armita)I appologyze for my bad formed question. It was quite late at the moment of writing.
What I like to know is how to outject User Entity Bean to Session Scope so, that
outjected user entity bean corresponds to logged one.
Thank you. -
24. Re: JAAS and SEAM
lcoetzee Mar 20, 2006 1:37 PM (in response to armita)Hi,
this was quite painful as there was no way I could find to do that automatically after the JAAS login. In the end we used an @Factory variable included in one of the admin templates to force the creation and outjection of the PortalUser. Something as follows:/** * if there is no portalUser, this method will execute */ @Factory("portalUser") public void loadCurrentPortalUser() { logger.info("**** FACTORY ****** portalUser is " + portalUser); try { String username = new String("unknown"); facesContext = FacesContext.getCurrentInstance(); if ( facesContext.getExternalContext().getUserPrincipal() == null ) { portalUser = null; logger.info("not logged in"); return; } // // get security login name // username = facesContext.getExternalContext(). getUserPrincipal().getName().toString(); // // create DB query // String query = new String("FROM " + PortalUser.class.getName() + " where login='" + username + "'"); // // get user from db // List list = em.createQuery(query).getResultList(); if ( list != null && list.size() > 0 ) { Object obj = list.get(0); if ( obj instanceof PortalUser ){ portalUser = (PortalUser) obj; Contexts.getSessionContext().set("portalUser",portalUser); } } } catch ( Throwable t ) { logger.error("portalUser factory throws " + t); portalUser = null; } }
Hope it helps
L -
25. Re: JAAS and SEAM
mirko27 Mar 26, 2006 12:58 PM (in response to armita)THank you for answering but I got more questions.
Where exactly did you put this Factory method?
And if I mark User Entity bean Scope-Session and Name-portalUser then it automatically loads it to session scope and does not give a change to factory, because it alrdy is there? or not? -
26. Re: JAAS and SEAM
mirko27 Mar 27, 2006 5:10 AM (in response to armita)Maybe you could even share your entire Seam application?
This would be great for learning Seam. -
27. Re: JAAS and SEAM
lcoetzee Mar 28, 2006 2:50 AM (in response to armita)Just add the following in the template that you use for those pages which live in the secure area. This will invoke the factory on the piece of Java code provided earlier, and as a result outject the portalUser in the session context. Place the Java code in a stateful bean as part of the bigger application (a good place would be in the JAASExample/src/java/csir/user/seam/ directory).
<h:outputText value="#{portalUser.login}" rendered="false"/>
Maybe you could even share your entire Seam application?
This would be great for learning Seam.
That is part of the plan. At this point the whole app is under heavy development with a severe deadline in the very near future. The whole thing is a highly configurable (read as multilingual) content management system (plus additional services) created with accessibility and usability in mind (the project is aimed as an information portal for accessibility and disability in South Africa, part of quite a big national initiative.)
See http://www.napsa.org.za/ for more information.
Regards
Louis -
28. Re: JAAS and SEAM
gavin.king Mar 28, 2006 5:01 AM (in response to armita)How is Seam working out? Is it successfully improving your productivity? Does anything really suck?
-
29. Re: JAAS and SEAM
lcoetzee Mar 28, 2006 5:34 AM (in response to armita)I love it. It has made a big improvement on our productivity (taken into account that I have taken a whole team with no experience with Java annotations, ejb3 (and hibernate3), JSF and facelets and have managed (almost done ;-) to develop a full featured, complicated application in less than 3 months (and that includes a lot of changing because of changes in requirements).
In addition I refactored our entity model quite late in the development process, which raised a few eyebrows, but in the end it basically was a non-event, virtually painless (showing me that the whole technology stack really integrates very well).
The only additional thing that we really need right now is the ability to kill the conversations: http://jira.jboss.com/jira/browse/JBSEAM-164
Regards
L