@Override
    public boolean authorizeRequest(final RegisteredServiceAccessStrategyRequest request) throws Throwable {
        if (isSurrogateAuthenticationSession(request)) {
            try {
                val args = new Object[]{request.getPrincipalId(), request.getAttributes(), LOGGER};
                val resource = ResourceUtils.getResourceFrom(SpringExpressionLanguageValueResolver.getInstance().resolve(this.groovyScript));
                val scriptFactory = ExecutableCompiledScriptFactory.getExecutableCompiledScriptFactory();
                return scriptFactory.fromResource(resource).execute(args, Boolean.class);
            } catch (final Exception e) {
                LoggingUtils.error(LOGGER, e);
            }
            return false;
        }
        return super.authorizeRequest(request);
    }
This is {@link GroovySurrogateRegisteredServiceAccessStrategy}.

@author Misagh Moayyed
@since 5.3.0
support/cas-server-support-surrogate-api/src/main/java/org/apereo/cas/services/GroovySurrogateRegisteredServiceAccessStrategy.java