Dynamic Themes - documentation 6.2.0-SNAPSHOT

79 views
Skip to first unread message

Daniel Maldonado

unread,
May 10, 2020, 10:50:30 PM5/10/20
to cas-...@apereo.org
CAS Version: 6.2.0-SNAPSHOT


File:  /etc/cas/cas.properties
...
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.cache=false
spring.thymeleaf.prefix=file:///etc/cas/templates
cas.view.templatePrefixes=file:///etc/cas/templates

Directory:   /etc/cas/templates/foo/…

File:  /etc/cas/templates/foo.properties:
cas.standard.css.file=/theme/foo/css/cas.css
cas.javascript.file=/theme/foo/js/cas.js
cas.admin.css.file=/theme/foo/css/admin.css

Error:  

2020-05-11 00:03:46,453 ERROR [org.thymeleaf.TemplateEngine] - <[THYMELEAF][https-openssl-nio-8443-exec-3] Exception processing template "casLoginView": Error resolving template [casLoginView], template might not exist or might not be accessible by any of the configured Template Resolvers>
org.thymeleaf.exceptions.TemplateInputException: Error resolving template [casLoginView], template might not exist or might not be accessible by any of the configured Template Resolvers
at org.thymeleaf.engine.TemplateManager.resolveTemplate(TemplateManager.java:869) ~[thymeleaf-3.0.11.RELEASE.jar:3.0.11.RELEASE]
at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:607) ~[thymeleaf-3.0.11.RELEASE.jar:3.0.11.RELEASE]
at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1098) ~[thymeleaf-3.0.11.RELEASE.jar:3.0.11.RELEASE]
at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1072) ~[thymeleaf-3.0.11.RELEASE.jar:3.0.11.RELEASE]


If I change the value in cas.properties to:
...
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.cache=false
#spring.thymeleaf.prefix=file:///etc/cas/templates. # <<=== Yes, I commented this out
cas.view.templatePrefixes=file:///etc/cas/templates

I get the error:

2020-05-11 02:43:04,246 WARN [org.apereo.cas.services.web.RegisteredServiceThemeResolver] - <Custom theme [foo] for service [AbstractRegisteredService(serviceId=^(http|https)://.*, name=HTTP and HTTPS, theme=foo, informationUrl=null, privacyUrl=null, responseType=null, id=10000001, description=This service definition authorizes all application urls that support HTTPS and IMAPS protocols., expirationPolicy=DefaultRegisteredServiceExpirationPolicy(deleteWhenExpired=false, notifyWhenDeleted=false, notifyWhenExpired=false, expirationDate=null), acceptableUsagePolicy=DefaultRegisteredServiceAcceptableUsagePolicy(enabled=true, messageCode=null, text=null), proxyPolicy=org.apereo.cas.services.RefuseRegisteredServiceProxyPolicy@1, proxyTicketExpirationPolicy=null, proxyGrantingTicketExpirationPolicy=null, serviceTicketExpirationPolicy=null, singleSignOnParticipationPolicy=null, evaluationOrder=10000, usernameAttributeProvider=org.apereo.cas.services.DefaultRegisteredServiceUsernameProvider@87297e2, logoutType=BACK_CHANNEL, environments=[], attributeReleasePolicy=ReturnAllowedAttributeReleasePolicy(super=AbstractRegisteredServiceAttributeReleasePolicy(attributeFilter=null, principalAttributesRepository=DefaultPrincipalAttributesRepository(), consentPolicy=DefaultRegisteredServiceConsentPolicy(enabled=true, excludedAttributes=null, includeOnlyAttributes=null, order=0), authorizedToReleaseCredentialPassword=false, authorizedToReleaseProxyGrantingTicket=false, excludeDefaultAttributes=false, authorizedToReleaseAuthenticationAttributes=true, principalIdAttribute=null, order=0), allowedAttributes=[]), multifactorPolicy=DefaultRegisteredServiceMultifactorPolicy(multifactorAuthenticationProviders=[], failureMode=UNDEFINED, principalAttributeNameTrigger=null, principalAttributeValueToMatch=null, bypassEnabled=false, forceExecution=false, bypassTrustedDeviceEnabled=false, bypassPrincipalAttributeName=null, bypassPrincipalAttributeValue=null, script=null), logo=null, logoutUrl=null, redirectUrl=null, accessStrategy=DefaultRegisteredServiceAccessStrategy(order=0, enabled=true, ssoEnabled=true, unauthorizedRedirectUrl=null, delegatedAuthenticationPolicy=DefaultRegisteredServiceDelegatedAuthenticationPolicy(allowedProviders=[], permitUndefined=true, exclusive=false), requireAllAttributes=true, requiredAttributes={}, rejectedAttributes={}, caseInsensitive=false), publicKey=null, authenticationPolicy=DefaultRegisteredServiceAuthenticationPolicy(requiredAuthenticationHandlers=[], criteria=null), properties={}, contacts=[])] cannot be located. Falling back to default theme...>
2020-05-11 02:43:04,391 WARN [org.apereo.cas.services.web.RegisteredServiceThemeResolver] - <Custom theme [foo] for service [AbstractRegisteredService(serviceId=^(http|https)://.*, name=HTTP and HTTPS, theme=foo, informationUrl=null, privacyUrl=null, responseType=null, id=10000001, description=This service definition authorizes all application urls that support HTTPS and IMAPS protocols., expirationPolicy=DefaultRegisteredServiceExpirationPolicy(deleteWhenExpired=false, notifyWhenDeleted=false, notifyWhenExpired=false, expirationDate=null), acceptableUsagePolicy=DefaultRegisteredServiceAcceptableUsagePolicy(enabled=true, messageCode=null, text=null), proxyPolicy=org.apereo.cas.services.RefuseRegisteredServiceProxyPolicy@1, proxyTicketExpirationPolicy=null, proxyGrantingTicketExpirationPolicy=null, serviceTicketExpirationPolicy=null, singleSignOnParticipationPolicy=null, evaluationOrder=10000, usernameAttributeProvider=org.apereo.cas.services.DefaultRegisteredServiceUsernameProvider@87297e2, logoutType=BACK_CHANNEL, environments=[], attributeReleasePolicy=ReturnAllowedAttributeReleasePolicy(super=AbstractRegisteredServiceAttributeReleasePolicy(attributeFilter=null, principalAttributesRepository=DefaultPrincipalAttributesRepository(), consentPolicy=DefaultRegisteredServiceConsentPolicy(enabled=true, excludedAttributes=null, includeOnlyAttributes=null, order=0), authorizedToReleaseCredentialPassword=false, authorizedToReleaseProxyGrantingTicket=false, excludeDefaultAttributes=false, authorizedToReleaseAuthenticationAttributes=true, principalIdAttribute=null, order=0), allowedAttributes=[]), multifactorPolicy=DefaultRegisteredServiceMultifactorPolicy(multifactorAuthenticationProviders=[], failureMode=UNDEFINED, principalAttributeNameTrigger=null, principalAttributeValueToMatch=null, bypassEnabled=false, forceExecution=false, bypassTrustedDeviceEnabled=false, bypassPrincipalAttributeName=null, bypassPrincipalAttributeValue=null, script=null), logo=null, logoutUrl=null, redirectUrl=null, accessStrategy=DefaultRegisteredServiceAccessStrategy(order=0, enabled=true, ssoEnabled=true, unauthorizedRedirectUrl=null, delegatedAuthenticationPolicy=DefaultRegisteredServiceDelegatedAuthenticationPolicy(allowedProviders=[], permitUndefined=true, exclusive=false), requireAllAttributes=true, requiredAttributes={}, rejectedAttributes={}, caseInsensitive=false), publicKey=null, authenticationPolicy=DefaultRegisteredServiceAuthenticationPolicy(requiredAuthenticationHandlers=[], criteria=null), properties={}, contacts=[])] cannot be located. Falling back to default theme...>
2020-05-11 02:43:04,959 INFO [org.apereo.inspektr.audit.support.Slf4jLoggingAuditTrailManager] - <Audit trail record BEGIN

I feel like I am very close but I cannot figure it out from the documentation as the documentation reads:

"Add a [theme_name].properties placed to the root of src/main/resources folder. Contents of this file should match the following:"

But I seriously doubt I have to recompile the software EVERY time I try to use a dynamic theme for a service.  

I am missing something but I cannot figure out what it is.

Root

unread,
May 16, 2020, 9:56:00 AM5/16/20
to CAS Community
Can you try with this variable?

cas.view.template-prefixes[0]=file:///etc/cas/templates


Daniel Maldonado

unread,
May 16, 2020, 10:20:48 AM5/16/20
to cas-...@apereo.org
Just changed the value to what you specified below and got the same error:

2020-05-16 14:04:15,369 WARN [org.apereo.cas.services.web.RegisteredServiceThemeResolver] - <Custom theme [foo] for service [AbstractRegisteredService(serviceId=^(http|https)://.*, name=HTTP and HTTPS, theme=epc, informationUrl=null, privacyUrl=null, responseType=null, id=0, description=This service definition authorizes all application urls that support HTTPS and IMAPS protocols., expirationPolicy=DefaultRegisteredServiceExpirationPolicy(deleteWhenExpired=false, notifyWhenDeleted=false, notifyWhenExpired=false, expirationDate=null), acceptableUsagePolicy=DefaultRegisteredServiceAcceptableUsagePolicy(enabled=true, messageCode=null, text=null), proxyPolicy=org.apereo.cas.services.RefuseRegisteredServiceProxyPolicy@1, proxyTicketExpirationPolicy=null, proxyGrantingTicketExpirationPolicy=null, serviceTicketExpirationPolicy=null, singleSignOnParticipationPolicy=null, evaluationOrder=10000, usernameAttributeProvider=org.apereo.cas.services.DefaultRegisteredServiceUsernameProvider@87297e2, logoutType=BACK_CHANNEL, environments=[], attributeReleasePolicy=ReturnAllowedAttributeReleasePolicy(super=AbstractRegisteredServiceAttributeReleasePolicy(attributeFilter=null, principalAttributesRepository=DefaultPrincipalAttributesRepository(), consentPolicy=DefaultRegisteredServiceConsentPolicy(enabled=true, excludedAttributes=null, includeOnlyAttributes=null, order=0), authorizedToReleaseCredentialPassword=false, authorizedToReleaseProxyGrantingTicket=false, excludeDefaultAttributes=false, authorizedToReleaseAuthenticationAttributes=true, principalIdAttribute=null, order=0), allowedAttributes=[]), multifactorPolicy=DefaultRegisteredServiceMultifactorPolicy(multifactorAuthenticationProviders=[], failureMode=UNDEFINED, principalAttributeNameTrigger=null, principalAttributeValueToMatch=null, bypassEnabled=false, forceExecution=false, bypassTrustedDeviceEnabled=false, bypassPrincipalAttributeName=null, bypassPrincipalAttributeValue=null, script=null), logo=null, logoutUrl=null, redirectUrl=null, accessStrategy=DefaultRegisteredServiceAccessStrategy(order=0, enabled=true, ssoEnabled=true, unauthorizedRedirectUrl=null, delegatedAuthenticationPolicy=DefaultRegisteredServiceDelegatedAuthenticationPolicy(allowedProviders=[], permitUndefined=true, exclusive=false), requireAllAttributes=true, requiredAttributes={}, rejectedAttributes={}, caseInsensitive=false), publicKey=null, authenticationPolicy=DefaultRegisteredServiceAuthenticationPolicy(requiredAuthenticationHandlers=[], criteria=null), properties={}, contacts=[])] cannot be located. Falling back to default theme...>

It is almost it is ignoring the “cas.view.template-prefixes…” directive in the cas.properties file.

--
- 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/7f28549b-ee1f-4bc4-8668-9f4797537eac%40apereo.org.

Root

unread,
May 16, 2020, 11:06:39 AM5/16/20
to CAS Community

Ok, at the end of the error it says "cannot be located" so might be path/permission issue?, make sure
/etc/cas/templates/ is accessible by tomcat, also instead of "file:///etc/cas/templates"  try "file:/etc/cas/templates"

IF you are still getting errors, enable DEBUG mode in
log4j2.xml, you may get more info.
To unsubscribe from this group and stop receiving emails from it, send an email to cas-...@apereo.org.

Daniel Maldonado

unread,
May 16, 2020, 12:03:17 PM5/16/20
to cas-...@apereo.org
This can’t be this difficult.  I am actually very surprised that it has taken this long to configure such an important project. If I ever get this working I am going to have to put together some instructions for a newbie as the current ones leave a lot to be desired in the form of examples :-) 

Anyway, my current configuration for /etc/cas/config/cas.properties
spring.thymeleaf.prefix[0]=file:/etc/cas/templates
cas.view.templatePrefixes[0]=file:/etc/cas/templates
...

Error in debug:

2020-05-16 15:58:29,329 DEBUG [org.apereo.cas.services.web.RegisteredServiceThemeResolver] - <Can't find bundle for base name foo, locale en_US>
java.util.MissingResourceException: Can't find bundle for base name epc, locale en_US
        at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:2055) ~[?:?]
        at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1689) ~[?:?]
        at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1593) ~[?:?]
        at java.util.ResourceBundle.getBundle(ResourceBundle.java:1284) ~[?:?]
        at org.apereo.cas.services.web.RegisteredServiceThemeResolver$CasThemeResourceBundleMessageSource.doGetBundle(RegisteredServiceThemeResolver.java:190) ~[cas-server-support-themes-core-6.2.0-SNAPSHOT.jar:6.2.0-SNAPSHOT]
        at org.apereo.cas.services.web.RegisteredServiceThemeResolver.determineThemeNameToChoose(RegisteredServiceThemeResolver.java:145) ~[cas-server-support-themes-core-6.2.0-SNAPSHOT.jar:6.2.0-SNAPSHOT]
        at org.apereo.cas.services.web.RegisteredServiceThemeResolver.resolveThemeName(RegisteredServiceThemeResolver.java:103) ~[cas-server-support-themes-core-6.2.0-SNAPSHOT.jar:6.2.0-SNAPSHOT]
        at org.apereo.cas.services.web.ChainingThemeResolver.resolveThemeName(ChainingThemeResolver.java:42) ~[cas-server-support-themes-core-6.2.0-SNAPSHOT.jar:6.2.0-SNAPSHOT]
        at org.springframework.web.servlet.support.RequestContextUtils.getTheme(RequestContextUtils.java:217) ~[spring-webmvc-5.2.5.RELEASE.jar:5.2.5.RELEASE]
        at org.springframework.web.servlet.support.RequestContext.getTheme(RequestContext.java:398) ~[spring-webmvc-5.2.5.RELEASE.jar:5.2.5.RELEASE]
        at org.thymeleaf.spring5.context.webmvc.SpringWebMvcThymeleafRequestContext.getTheme(SpringWebMvcThymeleafRequestContext.java:211) ~[thymeleaf-spring5-3.0.11.RELEASE.jar:3.0.11.RELEASE]

No better clues there :-/


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/959d6aea-f5b6-4678-a87e-f9f44b3cbb4c%40apereo.org.

Root

unread,
May 16, 2020, 12:24:48 PM5/16/20
to CAS Community


Check that full thread, CAS is expecting theme.properties file.

if you are editing heavily then this is obvious in CAS, and Yes CAS documentation needs a reincarnation! indeed :-).

Daniel Maldonado

unread,
May 16, 2020, 12:49:59 PM5/16/20
to cas-...@apereo.org
Yes, yet again, that thread implies that the “skeleton_in_ID.properties” belongs in the “src/main/resources/*.properties” directory.  
Which implies that it needs to be compiled into the war before it is found.  Why would “dynamic themes” need to be included in the source?
That is not dynamic in nature :-/

Daniel Maldonado

unread,
May 16, 2020, 4:17:28 PM5/16/20
to cas-...@apereo.org
OK, through a lot of trial and error I figured out where to put the files.
NOT in the source and NOT compiling it into the final war.  It is more of a runtime configuration option
which was very hard to figure out.

I will have to put together a small project to make sure no one else suffers this much.  Thank you for your help. 

-- 
- 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/1D4F86A3-2C9F-4142-BC54-8B69DCBA8CD6%40yahoo.com.

Daniel Maldonado

unread,
May 16, 2020, 7:37:07 PM5/16/20
to cas-...@apereo.org
I put together a small backup copy of the working version here:  https://github.com/dannymk/cas-dynamic-style

Root

unread,
May 16, 2020, 8:04:25 PM5/16/20
to CAS Community

Great, finally you got it, so is this your build only for docker?  https://github.com/dannymk/cas-dynamic-style
To unsubscribe from this group and stop receiving emails from it, send an email to cas-...@apereo.org.

--
- 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-...@apereo.org.

Daniel Maldonado

unread,
May 16, 2020, 8:34:04 PM5/16/20
to cas-...@apereo.org
This is using docker because it is the easiest and fastest way for me to test it.  However, you can use it as a base to build the app and test configurations as you go.  I left a lot of stuff out as including them would defeat the purpose of explaining the configuration for the style and were to place the css/js/templates.

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/14435357-4b7e-468f-a947-557426197735%40apereo.org.

Reply all
Reply to author
Forward
0 new messages