code: protected SamlRegisteredService verifySamlRegisteredService(final String serviceId) {
          if (StringUtils.isBlank(serviceId)) {
              throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE,
                  "Could not verify/locate SAML registered service since no serviceId is provided");
          }
          LOGGER.debug("Checking service access in CAS service registry for [{}]", serviceId);
          val registeredService =
              samlProfileHandlerConfigurationContext.getServicesManager()
                  .findServiceBy(samlProfileHandlerConfigurationContext.getWebApplicationServiceFactory().createService(serviceId));
          if (registeredService == null || !registeredService.getAccessStrategy().isServiceAccessAllowed()) {
              LOGGER.warn("[{}] is not found in the registry or service access is denied. Ensure service is registered in service registry", serviceId);
              throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE);
          }
  
          if (registeredService instanceof SamlRegisteredService) {
              val samlRegisteredService = (SamlRegisteredService) registeredService;
              LOGGER.debug("Located SAML service in the registry as [{}] with the metadata location of [{}]",
                  samlRegisteredService.getServiceId(), samlRegisteredService.getMetadataLocation());
              return samlRegisteredService;
          }
          LOGGER.error("CAS has found a match for service [{}] in registry but the match is not defined as a SAML service", serviceId);
          throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE);
      }
docs: Gets registered service and verify.
  
  @param serviceId the service id
  @return the registered service and verify