CAS 6.2.x Theming

107 views
Skip to first unread message

Piotr Krakowski

unread,
Jul 31, 2020, 4:34:21 AM7/31/20
to CAS Community

Hi! I am trying to set up my theme for CAS 6.2.x as default.
The file structure seems to be correct. I follow the documentation, but nothing happends.

I created:
cas/src/main/resources/services/pksoft-10000003.json
{
  "@class" : "org.apereo.cas.services.RegexRegisteredService",
  "serviceId" : "^https://www.example.org",
  "name" : "pksoft",
  "theme" : "pksoft",
  "id" : 10000003
}

cas/src/main/resources/static/theme/pksoft/css/admin.css (empty for now)

cas/src/main/resources/static/theme/pksoft/css/cas.css
:root {
    --cas-theme-primary: red;
    --cas-theme-primary-bg: rgba(241, 225, 79, 0.2);
    --cas-theme-primary-light: #006d85;
    --cas-theme-secondary: #74C163;
    --cas-theme-success: var(--cas-theme-secondary);
    --cas-theme-danger: var(--mdc-theme-error);
    --cas-theme-warning: #e6a210;
    --cas-theme-border-light: 1px solid rgba(0, 0, 0, .2);
    --cas-theme-twitter-color: #55acee;
    --cas-theme-vimeo-color: #1ab7ea;
    --cas-theme-vk-color: #587ea3;
    --cas-theme-yahoo-color: #720e9e;s
    --cas-theme-google-color: #CC5445;
    --cas-theme-facebook-color: #3B5998;
    --atlassian-theme-primary: #0747a6;
    --mdc-theme-primary: var(--cas-theme-primary, #153e50);
}

cas/src/main/resources/static/theme/pksoft/js/cas.js (empty for now)

cas/src/main/resources/templates/pksoft/casLoginView.html

cas/src/main/resources/pksoft.properties
cas.standard.css.file=/themes/phsoft/css/cas.css
cas.standard.js.file=/themes/pksoft/js/cas.js
cas.admin.css.file=/themes/pksoft/css/admin.css

and I added in cas/etc/cas/config/cas.properties
spring.main.allow-bean-definition-overriding=true
cas.serviceRegistry.json.location=classpath:/services
cas.theme.paramName=theme
cas.theme.defaultThemeName=pksoft

then i restart server

I have tried to add application.properties file with
cas.theme.paramName=theme
cas.theme.defaultThemeName=pksoft

but it only caused SSL_ERROR_CONNECTION

Can somebody help me with this, please?

Luís Costa

unread,
Jun 7, 2023, 10:29:54 AM6/7/23
to CAS Community, piok...@gmail.com
Hello,


Altough this thread is old, I leave my 2023 experience with CAS 6.6.8, so it may help others.


I'm using externalized views, because it was the only way I found to have hot/live reload when changing Thymeleaf views.

I this article Misagh writes about this livereload
https://fawnoos.com/2022/07/22/cas66-ui-themes/#deploying-views
but I could not get it to work.


Regarding you config, making and analogy to my working configs, I would only make it to work with

use (notice themes, not theme)
cas/src/main/resources/static/themes/pksoft/js/cas.js (empty for now)

instead of
cas/src/main/resources/static/theme/pksoft/js/cas.js (empty for now)


use (notice themes folder)
cas/src/main/resources/templates/themes/pksoft/casLoginView.html

instead of
cas/src/main/resources/templates/pksoft/casLoginView.html


Ok, I use the same logic for the theme props file
cas/src/main/resources/pksoft.properties


Ok, I use the same logic for the css and js paths
cas.standard.css.file=/themes/phsoft/css/cas.css
cas.standard.js.file=/themes/pksoft/js/cas.js


Don't have this config, I think it's because the CAS admin part is now an independent application
cas.admin.css.file=/themes/pksoft/css/admin.css


Didn't use this settings
cas.theme.paramName=theme
cas.theme.defaultThemeName=pksoft


As pointed here,
https://groups.google.com/a/apereo.org/g/cas-user/c/i4-Of4WUPm0/m/LZV4cgzvBQAJ
  4、Optimization suggestions
  I think there is a bug here. a mistake in the directory rules of template and theme
  CasThymeleafConfiguration.java
  theme.setPrefix(viewPath + "themes/%s/"); =>  theme.setPrefix(viewPath + "%s/");

and here
https://groups.google.com/a/apereo.org/g/cas-user/c/Yz-OjAPLwX8/m/Cf7MvUXCAQAJ

It seems that a bug exists on official docs
https://apereo.github.io/cas/6.6.x/ux/User-Interface-Customization-Themes.html#themed-views
"For instance, if the external path for CAS views is /etc/cas/templates, view template files for theme sample may be located /etc/cas/templates/sample/."

I think it should say
"For instance, if the external path for CAS views is /etc/cas/templates, view template files for theme sample may be located /etc/cas/templates/themes/sample/."


I used the same logig for static resources,
I have
/etc/cas/static/themes/my_custom_theme/css (and other folders)
instead of
/etc/cas/static/my_custom_theme/css (and other folders)


Kind regards
Reply all
Reply to author
Forward
0 new messages