class DefaultTwoFactorValidatorProvider implements TwoFactorValidatorProvider {

    private String provider;

    private TwoFactorTokenManager twoFactorTokenManager;

    public DefaultTwoFactorValidatorProvider(String provider, TwoFactorTokenManager twoFactorTokenManager) {
        this.provider = provider;
        this.twoFactorTokenManager = twoFactorTokenManager;
    }

    protected abstract boolean validate(String userId, String code);

    @Override
    public TwoFactorValidator createTwoFactorValidator(String userId, String operation) {<FILL_FUNCTION_BODY>}
}

        return new DefaultTwoFactorValidator(getProvider(), code -> validate(userId, code), () -> twoFactorTokenManager.getToken(userId, operation));
    
<no_super_class>