acegi-security and icefaces
[Logo]
Forums for ICEfaces and ICEpdf
[Search] Search   [Recent Topics] Recent Topics   [Groups] Home Page | www.icefaces.org  [Register] Register  [Login] Login 
acegi-security and icefaces  XML
Forum Index -> General Help Go to Page: Previous  1, 2, 3
Author Message
brad.kroeger

Joined: 26/10/2004 00:00:00
Messages: 263
Offline


The Spring framework jars are required, but beyond that acegi can be used without having to implement any other Spring functionality. See the example code I posted above, that is all that was required to add acegi to an ICEfaces application.

Brad Kroeger
Developer
ICEsoft Technologies, Inc.
[Email]
javawong369

Joined: 09/12/2006 00:00:00
Messages: 1
Offline


Hi:
Do you have the configuration examples for j_username and j_password, respectively, and a form action pointing to j_acegi_security_check. thanks.
david.malec

Joined: 15/11/2007 00:00:00
Messages: 1
Offline


Hello guys, I was trying philip.breau's acegi sample application security.war .
Whan it is deployed on Tomcat (5.5) it's working without problems.

Once I deploy it on JBoss 4.2.0 it's not working at all. Thy JBoss guys use JSF Sun RI 1.2 and when JBoss tried to deploy the application, errors occurs :


13:10:30,327 ERROR [[/security]] Exception sending context initialized event to listener instance of class org.jboss.web.jsf.integration.config.JBossJSFConfigur
eListener
java.lang.ClassCastException: com.sun.faces.application.ApplicationAssociate
at com.sun.faces.application.ApplicationAssociate.getInstance(ApplicationAssociate.java:172)
at com.sun.faces.config.JSFVersionTracker.publishInstanceToApplication(JSFVersionTracker.java:266)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:424)
at org.jboss.web.jsf.integration.config.JBossJSFConfigureListener.contextInitialized(JBossJSFConfigureListener.java:69)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3854)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4359)
.
.
.
.
.


Ok, this is obviously wrong JSF version, so I deleted these JAR files from security/WEB-INF/lib :
jsf-api.jar
jsf-impl.jar

After another JBoss launch application was succesfuly deployed. But when I accessed the application, this exception was thrown :


javax.servlet.ServletException: Servlet execution threw an exception
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264)
org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:135)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:229)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148)
org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:63)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

root cause

java.lang.LinkageError: loader constraints violated when linking javax/el/ELContext class
com.icesoft.faces.webapp.http.servlet.ServletView.<init>(ServletView.java:45)
com.icesoft.faces.webapp.http.servlet.SingleViewServlet.service(SingleViewServlet.java:39)
com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:89)
com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:35)
com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:59)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264)
org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:135)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:229)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148)
org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:63)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)


My next step was to delete another JAR : el-api.jar
Next JBoss start, after accessing application this error occurs :

javax.faces.FacesException: Can't parse stream for /login.jspx Error at (40, 104: Cannot invoke com.sun.faces.taglib.html_basic.InputTextTag.setValue - argument type mismatch
com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:488)
com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:150)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
com.icesoft.faces.webapp.http.core.PageServer$1.respond(PageServer.java:26)
com.icesoft.faces.webapp.http.servlet.ServletRequestResponse.respondWith(ServletRequestResponse.java:125)
com.icesoft.faces.webapp.http.core.PageServer.service(PageServer.java:31)
com.icesoft.faces.webapp.http.servlet.BasicAdaptingServlet.service(BasicAdaptingServlet.java:16)
com.icesoft.faces.webapp.http.servlet.SingleViewServlet.service(SingleViewServlet.java:48)
com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:89)
com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:35)
com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:59)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264)
org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:135)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:229)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148)
org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:63)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

root cause

java.lang.IllegalArgumentException: Cannot invoke com.sun.faces.taglib.html_basic.InputTextTag.setValue - argument type mismatch
org.apache.commons.digester.Digester.createSAXException(Digester.java:2540)
org.apache.commons.digester.Digester.createSAXException(Digester.java:2566)
org.apache.commons.digester.Digester.startElement(Digester.java:1276)
org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
org.apache.commons.digester.Digester.parse(Digester.java:1586)
com.icesoft.faces.webapp.parser.Parser.parse(Parser.java:122)
com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:482)
com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:150)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
com.icesoft.faces.webapp.http.core.PageServer$1.respond(PageServer.java:26)
com.icesoft.faces.webapp.http.servlet.ServletRequestResponse.respondWith(ServletRequestResponse.java:125)
com.icesoft.faces.webapp.http.core.PageServer.service(PageServer.java:31)
com.icesoft.faces.webapp.http.servlet.BasicAdaptingServlet.service(BasicAdaptingServlet.java:16)
com.icesoft.faces.webapp.http.servlet.SingleViewServlet.service(SingleViewServlet.java:48)
com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:89)
com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:35)
com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:59)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264)
org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:135)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:229)
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148)
org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:63)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)


Now I'm not sure how to continue, I tried to change JBoss JSF implementations as well, but withou success. Please if somebody can help me ;)

Have a nice day anyway

David.
GuntherD

Joined: 09/09/2007 00:00:00
Messages: 10
Offline


Hi,

Has anybody managed to get the "remember me" services working with the backing bean example? I have been following the pointers in the original Javakaffee post http://www.javakaffee.de/blog/2006/07/04/jsfacegi-authentication-with-a-backing-bean/?, but am stuck on the [/code]rememberMeServices.loginSuccess(request, response, authResult); [/code] part, because when I try to get the response like this [code]HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();[/code], the response object always returns null.

Any ideas anybody?

Thx
GuntherD

Joined: 09/09/2007 00:00:00
Messages: 10
Offline


Hi again,

Did some debugging, and managed to solve the question above (actually, it was not the response that was generating the NPE, but the rememberMeservice itself).

Anyway, I got it woking by implementing my own CustomTokenBasedRememberMeServices, because the standard one has a security measure in the 'loginSuccess' method, that effectively blocks the creation of a cookie is a certain parameter is not present. That parameter being linked to the actual checkbox on the login page. Obviously, since we're working with a backing bean, this parameter never gets sent.

My question however, does anybody know if there's a cleaner way to maybe pass this parameter, so I can keep on using the standard TokenBasedRememberMeServices? I'll keep digging, but any ideas are more then welcome.

Also, if there's interest, I'll post the necessary backing-bean code and securityContext.xml parameters.

Rgds,
GuntherD
kito99

Joined: 30/01/2007 00:00:00
Messages: 21
Offline


Is anything special required to integrate Acegi with ICEfaces if you're not using programmatic authentication? This app has a standard JSP for the login page (no JSF components), so we're not doing anything fancy. I am getting a Session expired exception quite a bit, though.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kito D. Mann - Author, JavaServer Faces in Action
http://www.virtua.com - JSF/Java EE consulting, training, and mentoring
http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info


~~~
Kito D. Mann - Author, JavaServer Faces in Action
http://www.virtua.com - JSF/Java EE consulting, training, and mentoring
http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info
ted.goddard

Joined: 26/10/2004 00:00:00
Messages: 589
Offline


kito99 wrote:
Is anything special required to integrate Acegi with ICEfaces if you're not using programmatic authentication? This app has a standard JSP for the login page (no JSF components), so we're not doing anything fancy. I am getting a Session expired exception quite a bit, though.
 


ICEfaces uses Acegi to determine the user role when request.isUserInRole() is not necessarily available (such as during Ajax Push). So if you have installed the Acegi .jar files globally for your application server so that Acegi can determine the user role from the Principal (this is the Acegi API used by ICEfaces), nothing additional should be required.

Are there any particular conditions that cause the Session Expired (other than session expiry, I expect)?

[Email]
kito99

Joined: 30/01/2007 00:00:00
Messages: 21
Offline


Thanks, Ted. I just wanted to make sure Acegi wasn't interfering with anything. I think the SessionExpired exception was due to the Tomcat persistence sessions, which I turned off. I haven't seen it since.

~~
Kito D. Mann - Author, JavaServer Faces in Action
http://www.virtua.com - JSF/Java EE consulting, training, and mentoring
http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info

~~~
Kito D. Mann - Author, JavaServer Faces in Action
http://www.virtua.com - JSF/Java EE consulting, training, and mentoring
http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info
 
Forum Index -> General Help Go to Page: Previous  1, 2, 3
Go to:   
Powered by JForum 2.1.7ice © JForum Team