casinthecloud / cas-pac4j-oauth-demo

CAS server demo to test the authentication delegation
https://www.casinthecloud.com
76 stars 62 forks source link

can't deploy #5

Closed magaton closed 9 years ago

magaton commented 11 years ago

Hi, when I try to run the demo under tomcat with latest CAS I am getting: 2013-07-19 20:22:33,204 ERROR [org.springframework.web.context.ContextLoader] - org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'centralAuthenticationService' defined in ServletContext resource [/WEB-INF/spring-configuration/applicationContext.xml]: Cannot resolve reference to bean 'authenticationManager' while setting constructor argument; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.jasig.cas.authentication.AuthenticationManagerImpl] for bean with name 'authenticationManager' defined in ServletContext resource [/WEB-INF/deployerConfigContext.xml]; nested exception is java.lang.ClassNotFoundException: org.jasig.cas.authentication.AuthenticationManagerImpl

any hint? Milan

leleuj commented 11 years ago

Unfortunately, I'm not surprised that there is an error on this demo.

There are main changes that have been lately committed to the CAS server 4.0.0 I need to adapt to.

Will do that next week as well as updating documentation BTW...

magaton commented 11 years ago

Thanks very much for the quick reply.. I am pretty much in a hurry to show a working demo on Tuesday. I've tried to solve it myself, but with missing class in the latest CAS server code and with no knowledge what should be used instead, i couldn't go much further. Do you maybe have any pointers how I can solve this? Thanks again. Milan

leleuj commented 11 years ago

OK. I'll try to update the demo on Monday. I think that most changes are located in the deployerConfigContext.xml file: try to start from the default one in CAS server : https://github.com/Jasig/cas/blob/master/cas-server-webapp/src/main/webapp/WEB-INF/deployerConfigContext.xml...

magaton commented 11 years ago

Thanks, I tried replacing deployerConfigContext.xml, but it seems that this is not the only problem. Now I have new exceptions on tomcat startup like:

Your help is much appreciated.

leleuj commented 11 years ago

Right! The logout has also been changed. I will take a look at that tomorrow... That said, I have a working demo with CAS 3.5.x : https://github.com/leleuj/cas-oauth-demo-3.5.x...

magaton commented 11 years ago

Thanks very much. I've tried demo with CAS 3.5.x, created a new issue and put some comments there.

leleuj commented 11 years ago

I've just updated the demo but it still doesn't work as a patch is required : https://issues.jasig.org/browse/CAS-1331...

leleuj commented 11 years ago

I just merged the pull request and everything works now...

magaton commented 11 years ago

Hi, I've pulled the latest: pac4j, cas and this demo, started cas & cas2 without the problem, but when I try to sign in with facebook, I am getting error: CAS is Unavailable There was an error trying to complete your request. Please notify your support desk or try again.

The tomcat log is: 2013-07-25 12:27:25,663 INFO [org.jasig.cas.web.flow.InitialFlowSetupAction] - <Setting path for cookies to: /cas/> 2013-07-25 12:27:26,748 INFO [org.jasig.cas.ticket.registry.support.DefaultTicketRegistryCleaner] - 2013-07-25 12:27:26,751 INFO [org.jasig.cas.ticket.registry.support.DefaultTicketRegistryCleaner] - <0 tickets found to be removed.> 2013-07-25 12:27:26,751 INFO [org.jasig.cas.ticket.registry.support.DefaultTicketRegistryCleaner] - 2013-07-25 12:27:30,783 INFO [org.jasig.cas.ticket.registry.support.DefaultTicketRegistryCleaner] - 2013-07-25 12:27:30,784 INFO [org.jasig.cas.ticket.registry.support.DefaultTicketRegistryCleaner] - <0 tickets found to be removed.> 2013-07-25 12:27:30,784 INFO [org.jasig.cas.ticket.registry.support.DefaultTicketRegistryCleaner] - 2013-07-25 12:28:41,313 ERROR [org.pac4j.oauth.client.BaseOAuth20Client] -

Any idea?

leleuj commented 11 years ago

Pretty strange : don't you have a more explicit log ? I tested the Facebook support in the demo and it works...

magaton commented 11 years ago

ok, it looks like it happens because i am already somehow authenticated (maybe left from the previous run). Btw, when I logout and login, it works, but this time it doesn't ask me to allow auth via Facebook.

This is the full trace in tomcat from the moment I clicked on "authenticate with FB":

2013-07-26 08:32:14,350 INFO [org.jasig.cas.web.flow.InitialFlowSetupAction] - <Setting path for cookies to: /cas/> 2013-07-26 08:32:14,355 DEBUG [org.jasig.cas.web.support.CasArgumentExtractor] - 2013-07-26 08:32:14,362 DEBUG [org.jasig.cas.support.pac4j.web.flow.ClientAction] - 2013-07-26 08:32:14,391 DEBUG [org.jasig.cas.support.pac4j.web.flow.ClientAction] - <FacebookClientUrl -> https://www.facebook.com/dialog/oauth?client_id=153186971478756&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fcas%2Flogin%3Fclient_name%3DFacebookClient&state=dSqYXVCJgb&scope=email%2Cuser_likes%2Cuser_about_me%2Cuser_birthday%2Cuser_education_history%2Cuser_hometown%2Cuser_relationship_details%2Cuser_location%2Cuser_religion_politics%2Cuser_relationships%2Cuser_work_history%2Cuser_website%2Cuser_photos%2Cuser_events%2Cuser_groups%2Cuser_actions.music> 2013-07-26 08:32:14,397 DEBUG [org.jasig.cas.support.pac4j.web.flow.ClientAction] - <TwitterClientUrl -> http://localhost:8080/cas/login?client_name=TwitterClient&needs_client_redirection=true> 2013-07-26 08:32:14,399 DEBUG [org.jasig.cas.support.pac4j.web.flow.ClientAction] - <CasOAuthWrapperClientUrl -> http://localhost:8080/cas2/oauth2.0/authorize?response_type=code&client_id=this_is_the_key&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fcas%2Flogin%3Fclient_name%3DCasOAuthWrapperClient> 2013-07-26 08:32:14,406 DEBUG [org.jasig.cas.support.pac4j.web.flow.ClientAction] - <CasClientUrl -> http://localhost:8080/cas2/login?service=http%3A%2F%2Flocalhost%3A8080%2Fcas%2Flogin%3Fclient_name%3DCasClient> 2013-07-26 08:32:14,519 DEBUG [org.jasig.cas.support.pac4j.web.flow.ClientAction] - <MyOpenIdClientUrl -> http://localhost:8080/cas/login?client_name=MyOpenIdClient&needs_client_redirection=true> 2013-07-26 08:32:14,645 DEBUG [org.jasig.cas.web.support.CasArgumentExtractor] - 2013-07-26 08:32:17,678 DEBUG [org.jasig.cas.web.support.CasArgumentExtractor] - 2013-07-26 08:32:17,678 DEBUG [org.jasig.cas.support.pac4j.web.flow.ClientAction] - 2013-07-26 08:32:17,678 DEBUG [org.jasig.cas.support.pac4j.web.flow.ClientAction] - <client : | callbackUrl: http://localhost:8080/cas/login?client_name=FacebookClient | name: null | isDirectRedirection: true |> 2013-07-26 08:32:17,679 ERROR [org.pac4j.oauth.client.BaseOAuth20Client] - 2013-07-26 08:32:17,684 DEBUG [org.jasig.cas.web.FlowExecutionExceptionResolver] - org.springframework.webflow.execution.ActionExecutionException: Exception thrown executing org.jasig.cas.support.pac4j.web.flow.ClientAction@356ed135 in state 'clientAction' of flow 'login' -- action execution attributes were 'map[[empty]]' at org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:60) at org.springframework.webflow.action.EvaluateAction.doExecute(EvaluateAction.java:77) at org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188) at org.springframework.webflow.execution.AnnotatedAction.execute(AnnotatedAction.java:145) at org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:51) at org.springframework.webflow.engine.ActionState.doEnter(ActionState.java:101) at org.springframework.webflow.engine.State.enter(State.java:194) at org.springframework.webflow.engine.Flow.start(Flow.java:535) at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:366) at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:222) at org.springframework.webflow.executor.FlowExecutorImpl.launchExecution(FlowExecutorImpl.java:140) at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:193) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.jasig.cas.web.init.SafeDispatcherServlet.service_aroundBody2(SafeDispatcherServlet.java:125) at org.jasig.cas.web.init.SafeDispatcherServlet.service_aroundBody3$advice(SafeDispatcherServlet.java:54) at org.jasig.cas.web.init.SafeDispatcherServlet.service(SafeDispatcherServlet.java:1) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.github.inspektr.common.web.ClientInfoThreadLocalFilter.doFilter(ClientInfoThreadLocalFilter.java:63) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:722) Caused by: org.pac4j.oauth.client.exception.OAuthCredentialsException: Missing state parameter : session expired or possible threat of cross-site request forgery at org.pac4j.oauth.client.BaseOAuth20Client.getOAuthCredentials(BaseOAuth20Client.java:81) at org.pac4j.oauth.client.BaseOAuthClient.retrieveCredentials(BaseOAuthClient.java:131) at org.pac4j.oauth.client.BaseOAuthClient.retrieveCredentials(BaseOAuthClient.java:44) at org.pac4j.core.client.BaseClient.getCredentials(BaseClient.java:134) at org.jasig.cas.support.pac4j.web.flow.ClientAction.doExecute(ClientAction.java:142) at org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188) at org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:51) ... 42 more

leleuj commented 11 years ago

About the logout and login which doesn't ask for premissions confirmation, it's normal : the second time Facebook does not ask about permissions.

Can you give some more details about the scenario which fails ? Thx