protected String extractSurrogateUser(final Credential mutableCredential) {
        return mutableCredential.getCredentialMetadata().getTrait(SurrogateCredentialTrait.class)
            .map(SurrogateCredentialTrait::getSurrogateUsername)
            .orElseThrow(() -> new SurrogateAuthenticationException("Unable to locate surrogate credential"));
    }
This is {@link SurrogateAuthenticationPrincipalBuilder}.

@author Misagh Moayyed
@since 5.3.0
support/cas-server-support-surrogate-core/src/main/java/org/apereo/cas/authentication/DefaultSurrogateAuthenticationPrincipalBuilder.java