@Override
    public <T extends Service> T createService(final String id, final Class<T> clazz) {
        var service = createService(id);
        if (!clazz.isAssignableFrom(service.getClass())) {
            throw new ClassCastException("Service [" + service.getId() + " is of type " + service.getClass() + " when we were expecting " + clazz);
        }
        return (T) service;
    }
Cleanup the url. Removes jsession ids and query strings.

@param url the url
@return sanitized url.
core/cas-server-core-services-authentication/src/main/java/org/apereo/cas/authentication/principal/AbstractServiceFactory.java