I'm using CAS 3.3.1 and trying to use two different themes depending on which website is being passed in as "service". If the user is coming from our test server, the pages should be rendered using the "default" theme, but if they come from our "m" server, they should get a sign-in page that is optimized for viewing on a smartphone.

So far, I have

copied the WEB-INF/view/jsp/default directory to WEB-INF/view/jsp/mobile.

made some changes to the WEB-INF/view/jsp/mobile/ui/casLoginView.jsp so I can tell which theme I am using.

copied the WEB-INF/classes/default_views.properties file to WEB-INF/classes/mobile.properties and WEB-INF/classes/mobile_views.properties (the instructions at https://wiki.jasig.org/display/CASUM/Theme+Control say to "Add another set of theme properties file, which must be placed to the root of /WEB-INF/classes folder, name it as theme_name.properties" but there was no "default.properties" file in that location, only a "default_views.properties" file, so I created both.

changed the links in these two files to point to the "mobile" directory instead of the "default" directory.

    updated cas-servlet.xml file to add "servicesManager-ref"
<bean id="themeResolver" class="org.jasig.cas.services.web.ServiceThemeResolver"
        p:defaultThemeName="${cas.themeResolver.defaultThemeName}"
        p:servicesManager-ref="servicesManager"
        p:argumentExtractors-ref="argumentExtractors" />

changed the theme for my "m" server to "mobile" in deployerConfigContext.xml: <bean id="serviceRegistryDao" class="org.jasig.cas.services.InMemoryServiceRegistryDaoImpl">
<property name="registeredServices">
<list>
<bean class="org.jasig.cas.services.RegisteredServiceImpl">
<property name="id" value="0" />
<property name="name" value="m.wvsom.edu" />
<property name="description" value="Allows access via m.wvsom.edu and uses a non-standard mobile-friendly theme" />
<property name="serviceId" value="http://m.wvsom.edu/**"; />
<property name="evaluationOrder" value="10000001" />
<property name="theme" value="mobile" />
<property name="allowedAttributes">
<list>
<value>UDC_IDENTIFIER</value>
</list>
</property>
</bean>

<bean class="org.jasig.cas.services.RegisteredServiceImpl">
<property name="id" value="1" />
<property name="name" value="WVSOM test" />
<property name="description" value="Allows WVSOM Test Server" />
<property name="serviceId" value="http://test.wvsom.edu/**"; />
<property name="evaluationOrder" value="10000002" />
<property name="allowedAttributes">
<list>
<value>UDC_IDENTIFIER</value>
</list>
</property>
</bean>
Restarted Tomcat, and the default theme continues to come up.

If I edit WEB-INF/cas.properties and change
cas.themeResolver.defaultThemeName=default
cas.viewResolver.basename=default_views

to
cas.themeResolver.defaultThemeName=mobile
cas.viewResolver.basename=mobile_views

then the new mobile theme comes up for everything.

So it seems like the theme is working, but it's either not reading the theme information from the serviceRegistry, or not getting the basename from it. Something's not linking up. I also have all the logs set to DEBUG and the only time the word "mobile" appears in the logs is when I set mobile to be the default theme and it rendered correctly. So it does not seem like CAS is even aware that I am trying to get it to display an alternate theme.

Any help greatly appreciated,

Aaron


--
You are currently subscribed to [email protected] as: 
[email protected]
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user

Reply via email to