This repository has been archived by the owner on Nov 3, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
Configuring JSON Service Registry
Misagh Moayyed edited this page Jul 17, 2013
·
25 revisions
- Create JSON configuration file
servicesRegistry.conf
and put it in/etc/cas
. Example services definitions:
{
"services":[
{
"id":1,
"serviceId":"https://www.google.com/**",
"name":"GOOGLE",
"description":"Test service with ant-style pattern matching",
"theme":"my_example_theme",
"allowedToProxy":true,
"enabled":true,
"ssoEnabled":true,
"anonymousAccess":false,
"evaluationOrder":1,
"allowedAttributes":["uid", "mail"]
},
{
"id":2,
"serviceId":"https://yahoo.com",
"name":"YAHOO",
"description":"Test service with exact match on its serviceId and optional extra attributes",
"extraAttributes":{
"someCustomAttribute":"Custom attribute value"
},
"evaluationOrder":2
},
{
"id":3,
"serviceId":"^(https?|imaps?)://.*",
"name":"HTTPS or IMAPS",
"description":"Test service with regex-style pattern matching of any service either via HTTPS or IMAPS",
"evaluationOrder":3
}
]
}
- Define
serviceRegistryDao
bean indeployerConfigContext
:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cas="http://unicon.net/schema/cas"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://unicon.net/schema/cas
http://unicon.net/schema/cas/cas-addons.xsd">
<!-- This definition uses the default config file location of /etc/cas/registeredServices.conf -->
<cas:json-services-registry/>
<!-- Use this form to configure with different config file location -->
<!-- <cas:json-services-registry config-file="/opt/cas/otherConfigFile.json"/> -->
</beans>
- To add change notification support:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:c="http://www.springframework.org/schema/c"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<!-- To enable JsonServiceRegistryDao#ServicesManagerInjectableBeanPostProcessor. Excludes the MongoDb services registry, which is defined as @Repository stereotype -->
<context:component-scan base-package="net.unicon.cas.addons.serviceregistry">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Repository"/>
</context:component-scan>
<cas:resource-change-detector id="registeredServicesChangeDetectingEventNotifier"
watched-resource="file:/etc/cas/servicesRegistry.conf"/>
<task:scheduler id="springScheduler" pool-size="3"/>
<task:scheduled-tasks scheduler="springScheduler">
<task:scheduled ref="registeredServicesChangeDetectingEventNotifier" method="notifyOfTheResourceChangeEventIfNecessary" fixed-delay="2000"/>
</task:scheduled-tasks>
</beans>
- To disable default CAS' registered services reloading and rely solely on cas-addons' resource change detection notification reloading behavior (available since version
1.5.3
):
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cas="http://unicon.net/schema/cas"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://unicon.net/schema/cas
http://unicon.net/schema/cas/cas-addons.xsd">
...
<cas:disable-default-registered-services-reloading/>
...
</beans>