@Override
    public String resolveUsernameInternal(final RegisteredServiceUsernameProviderContext context) throws Throwable {
        if (StringUtils.isNotBlank(groovyScript)) {
            val result = fetchAttributeValue(context, groovyScript);
            if (result != null) {
                LOGGER.debug("Found username [{}] from script", result);
                return result;
            }
        }
        LOGGER.warn("Groovy script [{}] is not valid. CAS will switch to use the default principal identifier [{}]",
            this.groovyScript, context.getPrincipal().getId());
        return context.getPrincipal().getId();
    }
Resolves the username for the service to be the default principal id.

@author Misagh Moayyed
@since 4.1.0
core/cas-server-core-services-api/src/main/java/org/apereo/cas/services/GroovyRegisteredServiceUsernameProvider.java