@Override
    public TokenDelegationResponse isDelegationAllowed(final TokenDelegationParameters tokenParameters) {
        val response = new TokenDelegationResponse();
        val delegateTarget = tokenParameters.getToken();
        response.setToken(delegateTarget);

        if (!delegateTarget.isDOMElement()) {
            return response;
        }

        if (delegateTarget.getState() == ReceivedToken.STATE.VALID && delegateTarget.getPrincipal() != null) {
            response.setDelegationAllowed(true);
            LOGGER.debug("Delegation is allowed for [{}]", delegateTarget.getPrincipal());
        } else {
            LOGGER.debug("Delegation is not allowed; token is invalid or the principal is undefined");
        }
        return response;
    }
This is {@link X509TokenDelegationHandler}.

@author Misagh Moayyed
@since 5.1.0
support/cas-server-support-ws-sts-api/src/main/java/org/apereo/cas/support/x509/X509TokenDelegationHandler.java