CAS 5.3.5 - Custom resources are not being applied at runtime

63 views
Skip to first unread message

Nick Elliott

unread,
Nov 1, 2018, 5:44:24 PM11/1/18
to CAS Community
I am running cas-overlay-template version 5.3.5 on Windows.

In src/main/resources/services, I have two different registered service json files, let's call them portal-1.json and portal-2.json. I have also modified src/main/resources/templates/casLoginView.html just to see if my changes are displayed.

When I build using "build run", during building I see this:

[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ cas-overlay ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources

Great, it seems like it found the resource files and moved them. When I look in target/cas/WEB-INF/classes/services/, I see portal-1.json and portal-2.json along with the two default Apereo .json files, Apereo-10000002.json and HTTPSandIMAPS-10000001.json. I also see my changes in target/cas/WEB-INF/classes/templates/casLoginView.html.

Once CAS is up and running, I do not see my change on the login screen and the logs show this:
2018-11-01 17:34:01,224 INFO [org.apereo.cas.services.AbstractServicesManager] - <Loaded [0] service(s) from [InMemoryServiceRegistry].>

NOTE: When I put the same service files in C:\etc\cas\services and update cas.properties in C:\etc\cas\config with the two lines below, the message above is "Loaded [2] service(s).."
cas.serviceRegistry.initFromJson=false
cas.serviceRegistry.json.location=file:/etc/cas/services


Looking at cas.war, I see:

$ jar -tf target/cas.war | grep json
WEB-INF/classes/services/Apereo-10000002.json
WEB-INF/classes/services/HTTPSandIMAPS-10000001.json
WEB-INF/classes/services/portal-1.json
WEB-INF/classes/services/portal-2.json

I didn't rip open the war to verify if my changes in casLoginView.html were there.

Any thoughts as to why my resources are not being applied at runtime?

Andy Ng

unread,
Nov 2, 2018, 12:54:23 AM11/2/18
to CAS Community
Hi Nick,

For the part about JSON, did you tried cas.serviceRegistry.initFromJson=true? 
Also, do you want your service bundled inside src/main/resources/services? If so you need this: cas.serviceRegistry.json.location=classpath:/services

The behavior shown in the part about casLoginView is very strange, I just check your part of code vs my part of code, both running CAS 5.3.5 in Windows and my can edit casLoginView.html just fine. 

Mind if you share the source code, so we can check it more in depth? 
I think just looking at what you've given in this post, you program have no problem at all.

Cheers!
- Andy

Nick Elliott

unread,
Nov 2, 2018, 8:57:54 AM11/2/18
to cas-...@apereo.org
Andy,

I was trying to keep my service bundled inside src/main/resources/services. Using cas.serviceRegistry.json.location=classpath:/services did the trick. I was under the impression that all resources would be applied if in src/main/resources/. Thank you for the clarification. I now see that this is clearly called out on the configuration properties page.

As for the casLoginView.html, I was able to verify it works. I originally just added some text inside the body expecting it to show up. This appears to have been a bad assumption. When I remove the loginFrom div, the login form does go away.

Thank you for your help! 

Nick

--
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
---
You received this message because you are subscribed to the Google Groups "CAS Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+u...@apereo.org.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/27a31662-22dd-4b4a-9724-f28db1057223%40apereo.org.

Andy Ng

unread,
Nov 2, 2018, 10:21:23 AM11/2/18
to CAS Community
Awesome! Glad it helps -Andy
Reply all
Reply to author
Forward
0 new messages