public CasShibRegisteredService findServiceByAppName(String appName) throws CasShibServiceRegistrarException { if (!isInitialized) { // this shouldn't happen here, but just in case initialize(); } for (RegisteredService entry : servicesManager.getAllServices()) { if (entry instanceof CasShibRegisteredService && entry.getName().equals(appName)) { return ((CasShibRegisteredService) entry); } } return null; }