casinthecloud / cas-overlay-demo

CAS server demo using the Maven overlay
https://www.casinthecloud.com
73 stars 36 forks source link

Demo not working: Application Not Authorized to Use CAS #17

Closed Erdou closed 7 years ago

Erdou commented 7 years ago

Hello,

I followed the exact steps on the README, but it ends up with an

Application Not Authorized to Use CAS

error message on the management app.

I think it's also linked to the Warn log I'm getting on the CAS server:

 2016-09-26 12:09:25,749 WARN [org.apereo.cas.web.flow.ServiceAuthorizationCheck] - <Service Management: missing service. Service [http://localhost:8081/cas-management/callback?client_name=CasClient] is not found in service registry.>
leleuj commented 7 years ago

Strange! I just tested it cannot reproduce the issue.

git clone git@github.com:leleuj/cas-overlay-demo.git
cd cas-overlay-demo
./run.sh
Erdou commented 7 years ago

Weird, which URL you used then to test? I don't see how http://localhost:8081/cas-management (in the README) can work as the registered localhost service is https. Just tested on a linux (I was on Windows) to be sure, but I'm still getting the same issue. I'm puzzled.

EDIT: I didn't see the "?" in the regex, my mistake. Then I'm even more puzzled. I'll write here if I find something.

leleuj commented 7 years ago

Yes, the regexp with the ? matches http:// requests. That's why it should work for you as well.

If you take a look at the logs, how many services are loaded? It should be 5 (2 by default + 3 in these demos)

Erdou commented 7 years ago

It's 5 I suppose (there is several lines, also with the HTTPSandIMAP one I saw on your site but never did this). I've put the logs below.

Btw, I modified grossly localhost service to [^https?://.*] for the tests but still the same result. Here I'm on linux, but on 10.11.127.24 as you can see.

I'm sure I'm doing something trivial badly :/

2016-10-03 17:32:43,511 WARN [org.apereo.cas.services.ServiceRegistryConfigWatcher] - <Found a service definition [^(https|imaps)://.*] with a duplicate id [10000001] in [/tmp/cas/services/HTTPSandIMAPS-10000001.json]. This will overwrite previous service definitions and is likely a configuration problem. Make sure all services have a unique id and try again.>
2016-10-03 17:32:43,526 WARN [org.apereo.cas.services.ServiceRegistryConfigWatcher] - <Found a service definition [^https?://.*] with a duplicate id [2] in [/tmp/cas/services/localhost-2.json]. This will overwrite previous service definitions and is likely a configuration problem. Make sure all services have a unique id and try again.>
2016-10-03 17:32:43,527 WARN [org.apereo.cas.services.ServiceRegistryConfigWatcher] - <Found a service definition [^https?://back.*] with a duplicate id [1] in [/tmp/cas/services/back-1.json]. This will overwrite previous service definitions and is likely a configuration problem. Make sure all services have a unique id and try again.>
2016-10-03 17:32:43,532 WARN [org.apereo.cas.services.ServiceRegistryConfigWatcher] - <Found a service definition [^https://www.apereo.org] with a duplicate id [10000002] in [/tmp/cas/services/Apereo-10000002.json]. This will overwrite previous service definitions and is likely a configuration problem. Make sure all services have a unique id and try again.>
2016-10-03 17:32:43,538 WARN [org.apereo.cas.services.ServiceRegistryConfigWatcher] - <Found a service definition [^https?://front.*] with a duplicate id [0] in [/tmp/cas/services/front-0.json]. This will overwrite previous service definitions and is likely a configuration problem. Make sure all services have a unique id and try again.>
2016-10-03 17:32:57,674 INFO [org.apereo.cas.configuration.CasConfigurationRebinder] - <Reloaded CAS configuration cas-org.apereo.cas.configuration.CasConfigurationProperties>
2016-10-03 17:33:00,959 WARN [org.apereo.cas.util.cipher.TicketGrantingCookieCipherExecutor] - <Secret key for encryption is not defined. CAS will attempt to auto-generate the encryption key>
2016-10-03 17:33:01,002 WARN [org.apereo.cas.util.cipher.TicketGrantingCookieCipherExecutor] - <Generated encryption key SZ60sWn5PDeQ7cqy0qD-u_84Kn0dAfoPEvpP1FVoEjY of size 256. The generated key MUST be added to CAS settings.>
2016-10-03 17:33:01,004 WARN [org.apereo.cas.util.cipher.TicketGrantingCookieCipherExecutor] - <Secret key for signing is not defined. CAS will attempt to auto-generate the signing key>
2016-10-03 17:33:01,004 WARN [org.apereo.cas.util.cipher.TicketGrantingCookieCipherExecutor] - <Generated signing key XskSnIEw_PQs5HmoxYyDHSbjHSoKCFgcPAz1jj9OQbYnN48VEqOI9qzUdn-Nkje8Q3HRc4mUupyGflSUqHaDYg of size 512. The generated key MUST be added to CAS settings.>
2016-10-03 17:33:02,140 WARN [org.apereo.cas.util.cipher.WebflowConversationStateCipherExecutor] - <Secret key for signing is not defined. CAS will attempt to auto-generate the signing key>
2016-10-03 17:33:02,141 WARN [org.apereo.cas.util.cipher.WebflowConversationStateCipherExecutor] - <Generated signing key _Npsx7UySu7B1ysUdTvoOpHbc1IzQbV8HglRXRUBGo8rtDc4UthllpYqddqespJdW1TB0WmNSpQcOTP_FhyE4g of size 512. The generated key MUST be added to CAS settings.>
2016-10-03 17:33:02,145 WARN [org.apereo.cas.util.cipher.WebflowConversationStateCipherExecutor] - <No encryption key is defined. CAS will attempt to auto-generate keys>
2016-10-03 17:33:02,145 WARN [org.apereo.cas.util.cipher.WebflowConversationStateCipherExecutor] - <Generated encryption key xtJfZMAWIeBZBraO of size 16. The generated key MUST be added to CAS settings.>
2016-10-03 17:33:02,244 INFO [org.apereo.cas.configuration.support.Beans] - <Ticket registry encryption/signing is turned off. This may NOT be safe in a clustered production environment. Consider using other choices to handle encryption, signing and verification of ticket registry tickets.>
2016-10-03 17:33:02,266 WARN [org.apereo.cas.ticket.registry.DefaultTicketRegistry] - <Runtime memory is used as the persistence storage for retrieving and managing tickets. Tickets that are issued during runtime will be LOST upon container restarts. This MAY impact SSO functionality.>
2016-10-03 17:33:03,397 INFO [org.apereo.cas.web.CasWebApplication] - <Started CasWebApplication in 90.576 seconds (JVM running for 94.164)>
2016-10-03 17:33:22,882 INFO [org.apereo.cas.services.DefaultServicesManagerImpl] - <Loaded 5 services from JsonServiceRegistryDao.>
2016-10-03 17:33:25,129 INFO [org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/cas]] - <Initializing Spring FrameworkServlet 'dispatcherServlet'>
2016-10-03 17:33:42,471 INFO [org.apereo.cas.services.DefaultServicesManagerImpl] - <Loaded 0 services from JsonServiceRegistryDao.>
2016-10-03 17:33:42,474 INFO [org.apereo.cas.services.DefaultServicesManagerImpl] - <Loaded 0 services from JsonServiceRegistryDao.>
2016-10-03 17:33:42,480 INFO [org.apereo.cas.services.DefaultServicesManagerImpl] - <Loaded 0 services from JsonServiceRegistryDao.>
2016-10-03 17:33:42,481 INFO [org.apereo.cas.services.DefaultServicesManagerImpl] - <Loaded 0 services from JsonServiceRegistryDao.>
2016-10-03 17:33:42,481 INFO [org.apereo.cas.services.DefaultServicesManagerImpl] - <Loaded 0 services from JsonServiceRegistryDao.>
2016-10-03 17:33:42,482 WARN [org.apereo.cas.services.ServiceRegistryConfigWatcher] - <No service definition was loaded from [/tmp/cas/services/HTTPSandIMAPS-10000001.json]>
2016-10-03 17:33:42,495 INFO [org.apereo.cas.services.DefaultServicesManagerImpl] - <Loaded 1 services from JsonServiceRegistryDao.>
2016-10-03 17:33:42,499 INFO [org.apereo.cas.services.DefaultServicesManagerImpl] - <Loaded 2 services from JsonServiceRegistryDao.>
2016-10-03 17:33:44,288 INFO [org.apereo.cas.web.flow.InitialFlowSetupAction] - <Setting path for cookies for warn cookie generator to: /cas/ >
2016-10-03 17:34:22,887 INFO [org.apereo.cas.services.DefaultServicesManagerImpl] - <Loaded 2 services from JsonServiceRegistryDao.>
2016-10-03 17:35:22,889 INFO [org.apereo.cas.services.DefaultServicesManagerImpl] - <Loaded 2 services from JsonServiceRegistryDao.>
2016-10-03 17:35:54,857 WARN [org.apereo.cas.web.flow.ServiceAuthorizationCheck] - <Service Management: missing service. Service [http://10.11.127.24:8081/cas-management/callback?client_name=CasClient] is not found in service registry.>
2016-10-03 17:36:22,905 INFO [org.apereo.cas.services.DefaultServicesManagerImpl] - <Loaded 2 services from JsonServiceRegistryDao.>
2016-10-03 17:37:22,910 INFO [org.apereo.cas.services.DefaultServicesManagerImpl] - <Loaded 2 services from JsonServiceRegistryDao.>
2016-10-03 17:38:22,912 INFO [org.apereo.cas.services.DefaultServicesManagerImpl] - <Loaded 2 services from JsonServiceRegistryDao.>
2016-10-03 17:39:22,917 INFO [org.apereo.cas.services.DefaultServicesManagerImpl] - <Loaded 2 services from JsonServiceRegistryDao.>
2016-10-03 17:40:22,919 INFO [org.apereo.cas.services.DefaultServicesManagerImpl] - <Loaded 2 services from JsonServiceRegistryDao.>
Erdou commented 7 years ago

Finally made it work! I cleaned everything and did back from scratch. This time I used the domain name instead of the IP, and everything went fine. I'm wondering if it's that or some mistake I've done before. Anyway, thank you for your support @leleuj ! :+1: