I noticed some strange behavior when applying custom themes in CAS. It 
seems the custom theme selection isn't happening for logout but it is for 
login. I've setup CAS with custom themes according to this: 
https://apereo.github.io/cas/5.0.x/installation/User-Interface-Customization-Themes.html.
 
I have the theme specific .properties file, custom CSS and image references 
externalized, and the theme property defined for my service. Using the 
Thymeleaf expressions to reference the custom theme works when logging in 
-- the custom theme is applied -- but then logging out the custom theme is 
not resolved properly. 

I noticed from the debug logs that when I login the 
RegisteredServiceThemeBasedViewResolver attempts to resolve a custom view 
for a service and then the ServiceThemeResolver attempts and succeeds to 
find the custom theme. When logging out, the 
RegisteredServiceThemeBasedViewResolver attempts to resolve a custom view 
but the resolveThemeName method within ServiceThemeResolver isn't reached. 
I determined this through running the app in debug mode. I'm trying to 
figure out if this is something that is incorrect in my configuration or if 
there is an issue within CAS. It seems to me that both login and logout 
should resolve the custom theme in the same way. 

I was able to provide a custom view for logging out as a workaround for the 
time being. 

*cas version:* 5.0.5
*environment:* java 8, tomcat 7
*login debug log snippet (custom theme resolved):* 

20:05:13.450 [http-bio-8080-exec-9] DEBUG 
org.apereo.cas.services.web.RegisteredServiceThemeBasedViewResolver - 
Attempting to locate views for service 
[^(https?)://([A-Za-z0-9_-]+)*localhost.*] with theme [generic]
20:05:13.450 [http-bio-8080-exec-9] DEBUG 
org.apereo.cas.services.web.RegisteredServiceThemeBasedViewResolver - 
Attempting to locate view at classpath:/templates/generic/casLoginView.html
20:05:13.451 [http-bio-8080-exec-9] DEBUG 
org.apereo.cas.services.web.RegisteredServiceThemeBasedViewResolver - View 
classpath:/templates/generic/casLoginView.html does not exist. Fallling 
back to default view at casLoginView
20:05:13.484 [http-bio-8080-exec-9] DEBUG 
org.apereo.cas.services.web.ServiceThemeResolver - Service 
[id=10003000,name=Development,description=Allows HTTP(S) for local 
connections,serviceId=^(https?)://([A-Za-z0-9_-]+)*localhost.*,usernameAttributeProvider=org.apereo.cas.services.DefaultRegisteredServiceUsernameProvider@d,theme=generic,evaluationOrder=10003000,logoutType=BACK_CHANNEL,attributeReleasePolicy=org.apereo.cas.services.ReturnAllowedAttributeReleasePolicy@4bde887f[attributeFilter=<null>,principalAttributesRepository=org.apereo.cas.authentication.principal.DefaultPrincipalAttributesRepository@78211866[],authorizedToReleaseCredentialPassword=false,authorizedToReleaseProxyGrantingTicket=false,allowedAttributes=[]],accessStrategy=org.apereo.cas.services.DefaultRegisteredServiceAccessStrategy@4e8a7f29[enabled=true,ssoEnabled=true,requireAllAttributes=true,requiredAttributes={},unauthorizedRedirectUrl=<null>,caseInsensitive=false,rejectedAttributes={}],publicKey=<null>,proxyPolicy=org.apereo.cas.services.RefuseRegisteredServiceProxyPolicy@594971eb,logo=<null>,logoutUrl=<null>,requiredHandlers=[],properties={},multifactorPolicy=org.apereo.cas.services.DefaultRegisteredServiceMultifactorPolicy@4d145192[multifactorAuthenticationProviders=[],failureMode=CLOSED,principalAttributeNameTrigger=<null>,principalAttributeValueToMatch=<null>],<null>]
 
is configured to use a custom theme [generic]
20:05:13.485 [http-bio-8080-exec-9] *DEBUG 
org.apereo.cas.services.web.ServiceThemeResolver - Found custom theme 
[generic] for service* [id=10003000,name=Development,description=Allows 
HTTP(S) for local 
connections,serviceId=^(https?)://([A-Za-z0-9_-]+)*localhost.*,usernameAttributeProvider=org.apereo.cas.services.DefaultRegisteredServiceUsernameProvider@d,theme=generic,evaluationOrder=10003000,logoutType=BACK_CHANNEL,attributeReleasePolicy=org.apereo.cas.services.ReturnAllowedAttributeReleasePolicy@4bde887f[attributeFilter=<null>,principalAttributesRepository=org.apereo.cas.authentication.principal.DefaultPrincipalAttributesRepository@78211866[],authorizedToReleaseCredentialPassword=false,authorizedToReleaseProxyGrantingTicket=false,allowedAttributes=[]],accessStrategy=org.apereo.cas.services.DefaultRegisteredServiceAccessStrategy@4e8a7f29[enabled=true,ssoEnabled=true,requireAllAttributes=true,requiredAttributes={},unauthorizedRedirectUrl=<null>,caseInsensitive=false,rejectedAttributes={}],publicKey=<null>,proxyPolicy=org.apereo.cas.services.RefuseRegisteredServiceProxyPolicy@594971eb,logo=<null>,logoutUrl=<null>,requiredHandlers=[],properties={},multifactorPolicy=org.apereo.cas.services.DefaultRegisteredServiceMultifactorPolicy@4d145192[multifactorAuthenticationProviders=[],failureMode=CLOSED,principalAttributeNameTrigger=<null>,principalAttributeValueToMatch=<null>],<null>]


*logout debug log snippet (custom theme not resolved):*

20:06:11.818 [http-bio-8080-exec-3] DEBUG 
org.apereo.cas.services.web.RegisteredServiceThemeBasedViewResolver - 
Attempting to locate views for service 
[^(https?)://([A-Za-z0-9_-]+)*localhost.*] with theme [generic]
20:06:11.818 [http-bio-8080-exec-3] DEBUG 
org.apereo.cas.services.web.RegisteredServiceThemeBasedViewResolver - 
Attempting to locate view at classpath:/templates/generic/casLogoutView.html
20:06:11.819 [http-bio-8080-exec-3] DEBUG 
org.apereo.cas.services.web.RegisteredServiceThemeBasedViewResolver - View 
classpath:/templates/generic/casLogoutView.html does not exist. Fallling 
back to default view at casLogoutView


*deployerConfigContext.xml:*

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"; xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance";
 xmlns:context="http://www.springframework.org/schema/context"; xmlns:p=
"http://www.springframework.org/schema/p";
 xmlns:c="http://www.springframework.org/schema/c"; xmlns:jee=
"http://www.springframework.org/schema/jee"; xmlns:aop=
"http://www.springframework.org/schema/aop";
 xmlns:tx="http://www.springframework.org/schema/tx"; xmlns:util=
"http://www.springframework.org/schema/util";
 xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/tx 
http://www.springframework.org/schema/tx/spring-tx.xsd
       http://www.springframework.org/schema/aop 
http://www.springframework.org/schema/aop/spring-aop.xsd
       http://www.springframework.org/schema/context 
http://www.springframework.org/schema/context/spring-context.xsd
       http://www.springframework.org/schema/jee 
http://www.springframework.org/schema/jee/spring-jee.xsd
       http://www.springframework.org/schema/util 
http://www.springframework.org/schema/util/spring-util.xsd";>

 <context:component-scan base-package="com.example.authentication" />
 <context:mbean-export registration="ignoreExisting" />
 <jee:jndi-lookup id="exampleAuthDataSource" jndi-name="auth_connection" 
expected-type="javax.sql.DataSource" />

 <bean id="serviceRegistryDao" class=
"org.apereo.cas.services.InMemoryServiceRegistryDaoImpl"
 p:registeredServices-ref="registeredServicesList" />

 <util:list id="registeredServicesList">
 <bean class="org.apereo.cas.services.RegexRegisteredService" p:id=
"10003000" p:name="Development"
 p:description="Allows HTTP(S) for local connections" p:serviceId=
"^(https?)://([A-Za-z0-9_-]+)*localhost.*"
 p:evaluationOrder="10003000" p:theme="generic">
 </bean>
 </util:list>
</beans>

-- 
- 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/ce7c45db-8496-426b-898d-3a6ea43e4b75%40apereo.org.

Reply via email to