Registered Services and Themes

Michael Olson molson at spitfiregroup.com
Tue Jun 6 11:34:37 EDT 2006



Hi Scott,

  Thanks for the reply.  It seems I greatly misspoke when I used the
word "theme".  The word I should have used was "view".  Is there a way
to control which view is used based on the current service?  I looked
through the ViewResolver interface and a handful of the implementations
and did not see any way to do this.


Thanks
Mike

------------------
Mike Olson
<A HREF="http://www.spitfiregroup.com/">The Spitfire Group</A>
Senior Technology Specialist
ph: 303-532-0984

-----Original Message-----
From: cas-bounces at tp.its.yale.edu [mailto:cas-bounces at tp.its.yale.edu]
On Behalf Of Scott Battaglia
Sent: Saturday, June 03, 2006 12:36 AM
To: Yale CAS mailing list
Subject: Re: Registered Services and Themes

Michael,

Generally with the themes you have one set of views and then within the 
views, anything that is "theme" specific is written using the Spring 
theme tag 
(http://static.springframework.org/spring/docs/1.2.x/taglib/tag/ThemeTag
.html). 

i.e.
<spring:theme code="css_file" />

You would also need to register this within your applicationContext: 
org.jasig.cas.services.web.ServiceThemeResolver

Check this out for more information:
http://static.springframework.org/spring/docs/2.0.x/reference/mvc.html#m
vc-themeresolver

Hope that helps!
-Scott

Scott Battaglia
Application Developer, Architecture & Engineering Team
Enterprise Systems and Services, Rutgers University
v: 732.445.0097 | f: 732.445.5493 | scott_battaglia at rutgers.edu 



Michael Olson wrote:
>
> Hello,
>
> I'm new to CAS but like what I have found so far. I'm trying to add it

> to an existing project. This project has a finite set of initial 
> access URLs. The URL controls what login screen the user sees as well 
> as how the user is authenticated. With what I have read and what I 
> have seen in the code, it seems a set of registered services is the 
> best way to accomplish the first goal using the "theme" member on the 
> RegisteredService. What I have been able to accomplish is to modify 
> web.xml and services.xml. Then using the yale client filter to access 
> my site I can get redirected to /login?service=accessURL. The CAS 
> server logs show that it does find the list of registered services. 
> Here is an example of one of my registered services
>
> <bean id="registeredService1" 
> class="org.jasig.cas.services.RegisteredService">
>
> <constructor-arg 
>
index="0"><value>http://localhost/LoginDemo/LoginURL1.html</value></cons
tructor-arg>
>
> <constructor-arg index="1"><value>true</value></constructor-arg>
>
> <constructor-arg index="2"><value>true</value></constructor-arg>
>
> <constructor-arg index="3"><value>theme1</value></constructor-arg>
>
> <constructor-arg 
>
index="4"><value>http://localhost/LoginDemo/LoginURL1.html</value></cons
tructor-arg>
>
> </bean>
>
> This is about as far as I can get. Every request goes to the default 
> theme, always. To implement the themes I have done the following:
>
> 1) Copied the default theme into sibling sub directories with names 
> such as theme1, theme2, etc. I made slight modifications to the login 
> screen so I would know which theme I am logging into
>
> 2) Added property files to WEB-INF/classes with names like 
> theme1_views.properties. These are copies of the 
> simple_views.properties with the URL links appropriately changed. 
> Example from theme2_views.properties: 
> casLoginView.url=/WEB-INF/view/jsp/theme2/ui/casLoginView.jsp
>
> 3) Modified the bean definition of viewResolver to include these new 
> base names. New definition is:
>
> a. <bean
>
> b. id="viewResolver"
>
> c. 
>
class="org.springframework.web.servlet.view.ResourceBundleViewResolver">
>
> d. <property
>
> e. name="basenames">
>
> f. <list>
>
> g. <value>default_views</value>
>
> h. <value>theme1_views</value>
>
> i. <value>theme2_views</value>
>
> j. </list>
>
> k. </property>
>
> l. <property
>
> m. name="order"
>
> n. value="0" />
>
> o. </bean>
>
> Then I try to access my URL again and am sent to the default login
page.
>
> Here is the URL I get redirected to:
>
>
http://localhost:8084/cas/login?service=http%3A%2F%2Flocalhost%2FLoginDe
mo%2FLoginURL1.html
>
> Any help would be greatly appreciated.
>
> Here is a snippet from the log file.
>
> 2006-06-02 09:43:12,786 INFO 
> [org.jasig.cas.ticket.registry.support.DefaultTicketRegistryCleaner] -

> <Starting cleaning of expired tickets from ticket registry at [Fri Jun

> 02 09:43:12 MDT 2006]>
>
> 2006-06-02 09:43:12,786 INFO 
> [org.jasig.cas.ticket.registry.support.DefaultTicketRegistryCleaner] -

> <0 found to be removed. Removing now.>
>
> 2006-06-02 09:43:12,786 INFO 
> [org.jasig.cas.ticket.registry.support.DefaultTicketRegistryCleaner] -

> <Finished cleaning of expired tickets from ticket registry at [Fri Jun

> 02 09:43:12 MDT 2006]>
>
> 2006-06-02 09:43:13,114 INFO 
>
[org.jasig.cas.services.support.SpringApplicationContextServiceRegistryR
eloader] 
> - <Checking if service list changed since last reload.>
>
> 2006-06-02 09:43:13,114 INFO 
>
[org.jasig.cas.services.support.SpringApplicationContextServiceRegistryR
eloader] 
> - <Last modified time changed on services.xml. File most likely 
> modified. Regenerating ServiceRegistry.>
>
> 2006-06-02 09:43:13,114 INFO 
> [org.springframework.beans.factory.support.DefaultListableBeanFactory]

> - <Destroying singletons in factory 
> {org.springframework.beans.factory.support.DefaultListableBeanFactory 
> defining beans [registeredService1,registeredService2]; root of 
> BeanFactory hierarchy}>
>
> 2006-06-02 09:43:13,145 INFO 
> [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - 
> <Loading XML bean definitions from class path resource [services.xml]>
>
> 2006-06-02 09:43:13,161 INFO 
> [org.springframework.context.support.ClassPathXmlApplicationContext] -

> <Bean factory for application context 
>
[org.springframework.context.support.ClassPathXmlApplicationContext;hash
Code=12514145]: 
> org.springframework.beans.factory.support.DefaultListableBeanFactory 
> defining beans [registeredService1,registeredService2]; root of 
> BeanFactory hierarchy>
>
> 2006-06-02 09:43:13,254 INFO 
> [org.springframework.context.support.ClassPathXmlApplicationContext] -

> <2 beans defined in application context 
>
[org.springframework.context.support.ClassPathXmlApplicationContext;hash
Code=12514145]>
>
> 2006-06-02 09:43:13,254 INFO 
> [org.springframework.context.support.ClassPathXmlApplicationContext] -

> <Unable to locate MessageSource with name 'messageSource': using 
> default 
> [org.springframework.context.support.DelegatingMessageSource at bafdff]>
>
> 2006-06-02 09:43:13,254 INFO 
> [org.springframework.context.support.ClassPathXmlApplicationContext] -

> <Unable to locate ApplicationEventMulticaster with name 
> 'applicationEventMulticaster': using default 
>
[org.springframework.context.event.SimpleApplicationEventMulticaster at 798
01c]>
>
> 2006-06-02 09:43:13,364 INFO 
> [org.springframework.beans.factory.support.DefaultListableBeanFactory]

> - <Pre-instantiating singletons in factory 
> [org.springframework.beans.factory.support.DefaultListableBeanFactory 
> defining beans [registeredService1,registeredService2]; root of 
> BeanFactory hierarchy]>
>
> 2006-06-02 09:43:13,364 DEBUG 
>
[org.jasig.cas.services.support.SpringApplicationContextServiceRegistryR
eloader] 
> - <Clearing out previous ServiceRegistry entries.>
>
> 2006-06-02 09:43:13,364 DEBUG 
> [org.jasig.cas.services.DefaultServiceRegistry] - <Clearing all 
> entries from Service Registry>
>
> 2006-06-02 09:43:13,473 DEBUG 
>
[org.jasig.cas.services.support.SpringApplicationContextServiceRegistryR
eloader] 
> - <Adding [http://localhost/LoginDemo/LoginURL1.html] to
ServiceRegistry>
>
> 2006-06-02 09:43:13,473 DEBUG 
> [org.jasig.cas.services.DefaultServiceRegistry] - <Adding service 
> [http://localhost/LoginDemo/LoginURL1.html] to serviceRegistry>
>
> 2006-06-02 09:43:13,473 DEBUG 
>
[org.jasig.cas.services.support.SpringApplicationContextServiceRegistryR
eloader] 
> - <Adding [http://localhost/LoginDemo/LoginURL2.html] to
ServiceRegistry>
>
> 2006-06-02 09:43:13,583 DEBUG 
> [org.jasig.cas.services.DefaultServiceRegistry] - <Adding service 
> [http://localhost/LoginDemo/LoginURL2.html] to serviceRegistry>
>
> 2006-06-02 09:44:21,926 DEBUG 
> [org.jasig.cas.web.flow.TicketGrantingTicketExistsAction] - <Action 
> 'org.jasig.cas.web.flow.TicketGrantingTicketExistsAction' beginning 
> execution>
>
> 2006-06-02 09:44:21,989 DEBUG 
> [org.jasig.cas.web.flow.TicketGrantingTicketExistsAction] - <Action 
> 'org.jasig.cas.web.flow.TicketGrantingTicketExistsAction' completed 
> execution; result event is [Event at 1127b52 source = 
> org.jasig.cas.web.flow.TicketGrantingTicketExistsAction at 5e7020, id = 
> 'noTicketGrantingTicketExists', stateId = [null], parameters =
[null]]>
>
> 2006-06-02 09:44:21,989 DEBUG 
> [org.jasig.cas.web.flow.GatewayRequestCheckAction] - <Action 
> 'org.jasig.cas.web.flow.GatewayRequestCheckAction' beginning
execution>
>
> 2006-06-02 09:44:21,989 DEBUG 
> [org.jasig.cas.web.flow.GatewayRequestCheckAction] - <Action 
> 'org.jasig.cas.web.flow.GatewayRequestCheckAction' completed 
> execution; result event is [Event at 16b904d source = 
> org.jasig.cas.web.flow.GatewayRequestCheckAction at cec78d, id = 
> 'authenticationRequired', stateId = [null], parameters = [null]]>
>
> 2006-06-02 09:44:22,051 INFO 
> [org.springframework.web.context.support.GenericWebApplicationContext]

> - <11 beans defined in application context 
>
[org.springframework.web.context.support.GenericWebApplicationContext;ha
shCode=28169315]>
>
> 2006-06-02 09:44:22,051 INFO 
> [org.springframework.web.context.support.GenericWebApplicationContext]

> - <Unable to locate MessageSource with name 'messageSource': using 
> default 
> [org.springframework.context.support.DelegatingMessageSource at 498713]>
>
> 2006-06-02 09:44:22,051 INFO 
> [org.springframework.web.context.support.GenericWebApplicationContext]

> - <Unable to locate ApplicationEventMulticaster with name 
> 'applicationEventMulticaster': using default 
>
[org.springframework.context.event.SimpleApplicationEventMulticaster at 143
23d5]>
>
> 2006-06-02 09:44:22,114 INFO 
> [org.springframework.ui.context.support.UiApplicationContextUtils] - 
> <Unable to locate ThemeSource with name 'themeSource': using default 
> [org.springframework.ui.context.support.DelegatingThemeSource at e580e1]>
>
> 2006-06-02 09:44:22,114 INFO 
> [org.springframework.beans.factory.support.DefaultListableBeanFactory]

> - <Pre-instantiating singletons in factory 
> [org.springframework.beans.factory.support.DefaultListableBeanFactory 
> defining beans 
>
[serviceErrorView,casLoginView,casServiceFailureView,casLogoutView,casLo
ginConfirmView,casProxySuccessView,casLoginGenericSuccessView,cas1Servic
eSuccessView,casServiceSuccessView,casProxyFailureView,cas1ServiceFailur
eView]; 
> parent: 
> org.springframework.beans.factory.support.DefaultListableBeanFactory 
> defining beans 
>
[themeResolver,viewResolver,localeResolver,localeChangeInterceptor,urlBa
sedViewResolver,errorHandlerResolver,loginFlow,handlerMappingA,handlerMa
ppingB,loginController,proxyValidateController,serviceValidateController
,legacyValidateController,proxyController,logoutController,simpleMapping
HandlerExceptionResolver,abstractLoginAction,abstractCasLoginAction,auth
enticationViaFormAction,gatewayRequestCheckAction,generateServiceTicketA
ction,hasServiceCheckAction,renewRequestCheckAction,sendTicketGrantingTi
cketAction,ticketGrantingTicketExistsAction,warnAction,warnCookieGenerat
or,ticketGrantingTicketCookieGenerator]; 
> parent: 
> org.springframework.beans.factory.support.DefaultListableBeanFactory 
> defining beans 
>
[messageSource,ticketGrantingTicketUniqueIdGenerator,serviceTicketUnique
IdGenerator,serviceTicketExpirationPolicy,grantingTicketExpirationPolicy
,centralAuthenticationService,proxy10Handler,ticketRegistry,ticketRegist
ryCleaner,jobDetailTicketRegistryCleaner,triggerJobDetailTicketRegistryC
leaner,scheduler,advisorAutoProxyCreator,authenticationManager,serviceRe
gistry,serviceAllowedMethodBeforeAdvice,serviceRequiresAuthenticationMet
hodBeforeAdvice,serviceAllowedToProxyMethodBeforeAdvice,serviceAllowedMe
thodBeforeAdviceAdvisor,serviceRequiresAuthenticationMethodBeforeAdviceA
dvisor,serviceAllowedToProxyMethodBeforeAdviceAdvisor,serviceRegistryJob
,jobDetailServiceRegistry,triggerJobDetailServiceRegistry,scheduler2]; 
> root of BeanFactory hierarchy]>
>
> 2006-06-02 09:44:25,473 INFO 
> [org.springframework.ui.context.support.ResourceBundleThemeSource] - 
> <Theme created: name 'default', basename [default]>
>
> 2006-06-02 09:44:25,489 INFO 
> [org.springframework.web.util.ExpressionEvaluationUtils] - <Using JSP 
> 2.0 ExpressionEvaluator>
>
>
------------------------------------------------------------------------
>
> _______________________________________________
> Yale CAS mailing list
> cas at tp.its.yale.edu
> http://tp.its.yale.edu/mailman/listinfo/cas
>   
_______________________________________________
Yale CAS mailing list
cas at tp.its.yale.edu
http://tp.its.yale.edu/mailman/listinfo/cas



More information about the cas mailing list