I still use this so I was looking for the JIRA link to CAS.  Why is it
so hard to find?  And, is JIRA open for public submittal of bugs or
patch files?

I was curious if this were in there?

David

On Thu, Jun 12, 2008 at 12:23 PM, David Whitehurst
<[email protected]> wrote:
> Scott:
>
> Here's the source too.
>
> /*
>  * Copyright 2007 The JA-SIG Collaborative. All rights reserved. See license
>  * distributed with this file and available online at
>  * http://www.uportal.org/license.html
>  */
> package org.jasig.cas.services;
>
> import java.util.*;
>
> import org.jasig.cas.util.DefaultLongNumericGenerator;
> import org.jasig.cas.util.LongNumericGenerator;
> import org.jasig.cas.util.annotation.NotNull;
>
> /**
>  * Configurable Service Registry Dao for production use (limited
> service registry).
>  * This class is created for a small number of service registrations that will
>  * be Spring configured and managed without the use of the services web
>  * interface. The service manager application is registered by default, but 
> it's
>  * web page directory /view/jsp/services can be removed to deny access.
>  *
>  * @author David Whitehurst
>  * @version $
>  * @since 3.1
>  *
>  */
> public final class EasyServiceRegistryDaoImpl implements ServiceRegistryDao {
>
>   �...@notnull
>    private List<RegisteredService> registeredServices = new
> ArrayList<RegisteredService>();
>
>    private LongNumericGenerator generator = new DefaultLongNumericGenerator();
>
>    private Map serviceMap = new HashMap();
>
>    public boolean delete(RegisteredService registeredService) {
>        return this.registeredServices.remove(registeredService);
>    }
>
>    public RegisteredService findServiceById(final long id) {
>        for (final RegisteredService r : this.registeredServices) {
>            if (r.getId() == id) {
>                return r;
>            }
>        }
>
>        return null;
>    }
>
>    public List<RegisteredService> load() {
>
>        // always load Service Manager application
>        registerApplication("Service Manager",
> "https://localhost:8443/cas/services/**";);
>
>        // get registered applications
>        addRegisteredApplications();
>
>        return this.registeredServices;
>    }
>
>    public RegisteredService save(final RegisteredService registeredService) {
>        if (registeredService.getId() == -1) {
>            ((RegisteredServiceImpl)
> registeredService).setId(this.generator.getNextLong());
>        }
>
>        this.registeredServices.remove(registeredService);
>        this.registeredServices.add(registeredService);
>
>        return registeredService;
>    }
>
>    public void setRegisteredServices(final List<RegisteredService>
> registeredServices) {
>        this.registeredServices = registeredServices;
>    }
>
>    public void setServiceMap(Map serviceMap) {
>        this.serviceMap = serviceMap;
>    }
>
>    private void addRegisteredApplications() {
>
>        for (Iterator it=serviceMap.entrySet().iterator(); it.hasNext(); ) {
>            Map.Entry entry = (Map.Entry)it.next();
>            String key = (String) entry.getKey();
>            String value = (String) entry.getValue();
>
>            // register application
>            registerApplication(key, value);
>        }
>    }
>
>    private void registerApplication(String name, String urlPattern) {
>
>        final RegisteredServiceImpl r = new RegisteredServiceImpl();
>        r.setName(name);
>        r.setDescription("This is the description for the " + name);
>        r.setServiceId(urlPattern);
>        r.setAllowedToProxy(true);
>        r.setAnonymousAccess(false);
>        r.setEnabled(true);
>        r.setSsoEnabled(true);
>        r.setId(this.generator.getNextLong());
>
>        if (r.getId() == -1) {
>            ((RegisteredServiceImpl) r).setId(this.generator.getNextLong());
>        }
>
>        this.registeredServices.remove(r);
>        this.registeredServices.add(r);
>
>    }
> }
>
>
> David
>
> ---------- Forwarded message ----------
> From: David Whitehurst <[email protected]>
> Date: Jun 12, 2008 10:41 AM
> Subject: Service Manager or registry
> To: Scott Battaglia <[email protected]>
>
>
> Scott:
>
> I found a slick solution to an issue where our Chief Security Officer
> didn't want the /services part of CAS even available.  I removed the
> directory from view/jsp and that worked great!  In fact, if you try to
> navigate /cas/services it takes you to the login page (no nasty
> errors)
>
> But, ... we've had to use it to register and store the services.  And,
> when chief sitting bull didn't want to use Oracle, he said use HSQL
> (doh!).  Anyhow, I'm not using HSQL at all now and I've come up with a
> way for the Linux admin to register services easily.
>
> I would like to add my source if possible.  What's your opinion?
>
> <!--
>  Brute-force, hard coded service registry.  This is simple and it works.
>  -->
> <bean id="serviceRegistryDao"
>  class="org.jasig.cas.services.EasyServiceRegistryDaoImpl">
>  <property name="serviceMap">
>    <map>
>     <entry key="Pavement Management"
> value="http://localhost:8080/dummy1/**"; />
>    </map>
>  </property>
> </bean>
>
> The other properties would be accross the board or could be configured
> to apply to all, e.g. enabled? (easy, in here or not).  Proxy is
> probably okay on all the time.  And SSO would be the same.
>
> If you want my code, I'll send it.  Or ... (hint, hint) if you would
> like my help, I would love to commit on this project.
>
> Thanks,
>
> David
>



-- 
David L. Whitehurst
http://www.capehenrytech.com … Providing software instruction through
a sea of Technology.

-- 
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-dev

Reply via email to